From 6944b2ca4d0f4104d6ec6a941df7a67001db9a2c Mon Sep 17 00:00:00 2001 From: golles Date: Sat, 9 Jul 2022 11:27:28 +0200 Subject: [PATCH] When company is a mention, link it --- src/components/details/index.jsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/details/index.jsx b/src/components/details/index.jsx index bd3c8f2..7e88689 100644 --- a/src/components/details/index.jsx +++ b/src/components/details/index.jsx @@ -42,6 +42,14 @@ const ListItem = ({ icon, title, value, link, skeleton = false }) => { ); }; +const isCompanyMention = (company) => { + return company.startsWith('@') && !company.includes(' '); +}; + +const companyLink = (company) => { + return `https://github.com/${company.substring(1)}`; +}; + const Details = ({ profile, loading, social, github }) => { const renderSkeleton = () => { let array = []; @@ -80,6 +88,11 @@ const Details = ({ profile, loading, social, github }) => { icon={} title="Company:" value={profile.company} + link={ + isCompanyMention(profile.company) + ? companyLink(profile.company) + : null + } /> )}