Skip to content

Commit

Permalink
feat: display component list without logo
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulFarault committed Feb 19, 2024
1 parent 27f26e5 commit 16c3292
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/components/Architecture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ const Components = ({
title: string;
components: { name: string; logo: string; link: string }[];
}) => {
return (
<li>
const isLogo = components.every((c) => c.logo.endsWith(".svg"));

const listWithLogos = (
<>
<h4>{title}</h4>
<ul className="flex divide-x overflow-auto rounded-lg bg-gris-lighter">
{components.map((component) => (
Expand All @@ -29,8 +31,30 @@ const Components = ({
</li>
))}
</ul>
</li>
</>
);

const listWithoutLogos = (
<p className="flex">
<h4>{title}:&nbsp;</h4>
{components.map((component, i) => (
<>
<a
key={component.name}
href={component.link}
target="_blank"
rel="noopener noreferrer"
className="hover:text-tdp-light"
>
{component.name}
</a>
{i !== components.length - 1 && <span>,&nbsp;</span>}
</>
))}
</p>
);

return <li>{isLogo ? listWithLogos : listWithoutLogos}</li>;
};

export default function Architecture({
Expand Down

0 comments on commit 16c3292

Please sign in to comment.