Skip to content

Commit 4145846

Browse files
committed
feat: support target prop in Footer links
1 parent b0da775 commit 4145846

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

.changeset/loud-actors-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bigcommerce/catalyst-makeswift": minor
3+
---
4+
5+
Now have the ability to make footer links open in new tabs

core/lib/makeswift/components/site-footer/client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ interface Props {
4343
title: string;
4444
links: Array<{
4545
label: string;
46-
link: { href: string };
46+
link: { href: string; target?: string };
4747
}>;
4848
}>;
4949
copyright?: string;
@@ -57,7 +57,7 @@ function combineSections(
5757
passedSections,
5858
makeswiftSections.map(({ title, links }) => ({
5959
title,
60-
links: links.map(({ label, link }) => ({ label, href: link.href })),
60+
links: links.map(({ label, link }) => ({ label, href: link.href, target: link.target })),
6161
})),
6262
(left, right) => ({ ...left, links: [...left.links, ...right.links] }),
6363
);

core/vibes/soul/sections/footer/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface Image {
1414
interface Link {
1515
href: string;
1616
label: string;
17+
target?: string;
1718
}
1819

1920
export interface Section {
@@ -175,6 +176,8 @@ export const Footer = ({
175176
<Link
176177
className="block rounded-lg py-2 text-sm font-medium text-[var(--footer-link,hsl(var(--contrast-500)))] ring-[var(--footer-focus,hsl(var(--primary)))] transition-colors duration-300 hover:text-[var(--footer-link-hover,hsl(var(--foreground)))] focus-visible:outline-0 focus-visible:ring-2"
177178
href={link.href}
179+
rel={link.target === '_blank' ? 'noopener noreferrer' : undefined}
180+
target={link.target}
178181
>
179182
{link.label}
180183
</Link>

0 commit comments

Comments
 (0)