From c97a368ed3b2f017f81414e76dd16058f10b0ab0 Mon Sep 17 00:00:00 2001 From: Rastislav Date: Fri, 10 May 2024 18:53:23 +0200 Subject: [PATCH] Organization fix Fix for multiple organizations --- src/components/details-card/index.tsx | 72 ++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/src/components/details-card/index.tsx b/src/components/details-card/index.tsx index 2525bfc..28d2b4a 100644 --- a/src/components/details-card/index.tsx +++ b/src/components/details-card/index.tsx @@ -66,10 +66,7 @@ const ListItem: React.FC<{ skeleton?: boolean; }> = ({ icon, title, value, link, skeleton = false }) => { return ( -
@@ -83,9 +80,68 @@ const ListItem: React.FC<{ wordBreak: 'break-word', }} > - {value} + + {value} +
- + + ); +}; + +const OrganizationItem: React.FC<{ + icon: React.ReactNode; + title: React.ReactNode; + value: React.ReactNode | string; + link?: string; + skeleton?: boolean; +}> = ({ icon, title, value, link, skeleton = false }) => { + const renderValue = () => { + if (typeof value === 'string') { + return value.split(" ").map((company) => { + company = company.trim(); + if (!company) return null; + + if (isCompanyMention(company)) { + return ( + + {company} + + ); + } else { + return ( + {company} + ); + } + }); + } + return value; + }; + + return ( +
+
+ {icon} {title} +
+
+ {renderValue()} +
+
); }; @@ -132,9 +188,9 @@ const DetailsCard = ({ profile, loading, social, github }: Props) => { /> )} {profile.company && ( - } - title="Company:" + title="Organization:" value={profile.company} link={ isCompanyMention(profile.company.trim())