diff --git a/src/components/MenteeList/index.tsx b/src/components/MenteeList/index.tsx index f0653f95..03ac16f6 100644 --- a/src/components/MenteeList/index.tsx +++ b/src/components/MenteeList/index.tsx @@ -1,37 +1,15 @@ -import React, { useState } from 'react'; -import UserIcon from '../../assets/svg/Icons/UserIcon'; +import React from 'react'; import { Mentee } from '../../types'; - -const MenteeProfilePic: React.FC<{ src: string; alt: string }> = ({ - src, - alt, -}) => { - const [isError, setIsError] = useState(false); - - return isError || !src ? ( -
- -
- ) : ( - {alt} { - setIsError(true); - }} - /> - ); -}; +import ProfilePic from '../ProfilePic'; const MenteesList: React.FC<{ mentees: Mentee[] }> = ({ mentees }) => (
{mentees?.map((mentee, index) => (
-
{`${mentee.application.firstName} ${mentee.application.lastName}`} diff --git a/src/components/ProfilePic/index.tsx b/src/components/ProfilePic/index.tsx new file mode 100644 index 00000000..82d48394 --- /dev/null +++ b/src/components/ProfilePic/index.tsx @@ -0,0 +1,32 @@ +import React, { useState } from 'react'; +import UserIcon from '../../assets/svg/Icons/UserIcon'; + +const ProfilePic: React.FC<{ src: string; alt: string; size: string }> = ({ + src, + alt, + size, +}) => { + const [isError, setIsError] = useState(false); + + return isError || !src ? ( +
+ +
+ ) : ( + {alt} { + setIsError(true); + }} + /> + ); +}; + +export default ProfilePic;