Skip to content

Commit

Permalink
[#362] dont show links when unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sworzen1 committed Mar 6, 2024
1 parent 192fb0a commit 865f431
Showing 1 changed file with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,30 @@ export const ReviewCreatedGovernanceAction = ({

const renderLinks = () => {
const links = values["links"]?.map((item) => item.link) ?? [];
const areLinks = links.some((item) => item);

return links.map((link: string) => {
return (
<LinkWithIcon
icon={<img src={ICONS.link} />}
label={link}
onClick={() => onClickLink(link)}
sx={{ mb: 1.75 }}
/>
);
});
return areLinks ? (
<>
<Typography
color="neutralGray"
fontWeight={400}
sx={{ mb: 0.5 }}
variant="body2"
>
{t("createGovernanceAction.supportingLinks")}
</Typography>
{links.map((link: string) => {
return link ? (
<LinkWithIcon
icon={<img src={ICONS.link} />}
label={link}
onClick={() => onClickLink(link)}
sx={{ mb: 1.75 }}
/>
) : null;
})}
</>
) : null;
};

return (
Expand Down Expand Up @@ -97,14 +110,6 @@ export const ReviewCreatedGovernanceAction = ({
</Button>
<Spacer y={6} />
{renderReviewFields()}
<Typography
color="neutralGray"
fontWeight={400}
sx={{ mb: 0.5 }}
variant="body2"
>
{t("createGovernanceAction.supportingLinks")}
</Typography>
{renderLinks()}
<Spacer y={6} />
</BgCard>
Expand Down

0 comments on commit 865f431

Please sign in to comment.