When company is a mention, link it

This commit is contained in:
golles 2022-07-09 11:27:28 +02:00
parent fb55338ea9
commit 6944b2ca4d

View File

@ -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={<FaBuilding className="mr-2" />}
title="Company:"
value={profile.company}
link={
isCompanyMention(profile.company)
? companyLink(profile.company)
: null
}
/>
)}
<ListItem