11import { Box , Card , Divider , Group , Stack , Text , Tooltip } from "@mantine/core" ;
22import { PiBuildingsBold } from "react-icons/pi" ;
3- import { FaGithub , FaLinkedin , FaTwitter } from "react-icons/fa" ;
43import { ProfileAvatar } from "../Common" ;
54import { Link } from "react-router-dom" ;
5+ import { SOCIAL_LINKS_DATA } from "@/utils/constants" ;
66
77function UserProfileCard ( { user } : { user : any } ) {
88 const userStats = [
@@ -17,11 +17,6 @@ function UserProfileCard({ user }: { user: any }) {
1717 url : value ,
1818 } ) ) ;
1919
20- const socialLinksIcons = {
21- github : < FaGithub /> ,
22- linkedin : < FaLinkedin /> ,
23- twitter : < FaTwitter /> ,
24- } ;
2520 return (
2621 < Card withBorder padding = "xl" radius = "md" w = { 350 } >
2722 < Card . Section
@@ -43,32 +38,44 @@ function UserProfileCard({ user }: { user: any }) {
4338 </ Text >
4439 < StatsList stats = { userStats } />
4540 < Divider my = "md" />
41+ < Stack gap = { 7 } >
42+ < Text fz = "sm" c = "dimmed" ta = "center" >
43+ Joined Cranecloud { user ?. age }
44+ </ Text >
4645
47- < Text fz = "sm" mb = "md" c = "dimmed" ta = "center" >
48- Joined Cranecloud { user ?. age }
49- </ Text >
50- < Stack gap = { 4 } >
5146 { user ?. biography && (
52- < Text fz = "sm" c = "black" ta = "center" lineClamp = { 3 } fw = { 300 } >
47+ < Text fz = "sm" ta = "center" lineClamp = { 3 } fw = { 500 } >
5348 { user ?. biography }
5449 </ Text >
5550 ) }
56- < Divider my = "md" />
57-
51+ </ Stack >
52+ < Divider my = "md" />
53+ < Stack gap = { 7 } fz = "sm" fw = { 500 } >
5854 { user ?. organisation && (
59- < Group gap = { 5 } fz = "0.9rem" fw = { 600 } mt = "sm" >
60- < PiBuildingsBold size = { 17 } />
55+ < Group gap = { 10 } >
56+ < PiBuildingsBold size = { 16 } />
6157 { user ?. organisation }
6258 </ Group >
6359 ) }
64- { links . map ( ( link , index ) => (
65- < Link key = { index } to = { link . url as string } target = "_blank" >
66- < Group gap = { 5 } fz = "0.9rem" >
67- { socialLinksIcons [ link . platform as keyof typeof socialLinksIcons ] }
68- { link . url as string }
69- </ Group >
70- </ Link >
71- ) ) }
60+ { links . map ( ( link , index ) => {
61+ const platform = SOCIAL_LINKS_DATA . find (
62+ ( p ) => p . value === link . platform ,
63+ ) ;
64+ const IconComponent = platform ?. icon ;
65+
66+ return (
67+ < Link key = { index } to = { link . url as string } target = "_blank" >
68+ < Group gap = { 10 } align = "center" >
69+ { IconComponent && (
70+ < IconComponent size = { 16 } color = { platform ?. color } />
71+ ) }
72+ < Text size = "sm" style = { { flex : 1 } } >
73+ { link . url as string }
74+ </ Text >
75+ </ Group >
76+ </ Link >
77+ ) ;
78+ } ) }
7279 </ Stack >
7380 </ Card >
7481 ) ;
0 commit comments