Skip to content

Commit

Permalink
fix: footer links
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeavan-zengenti committed Feb 20, 2024
1 parent de23fe9 commit f39339d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
19 changes: 5 additions & 14 deletions src/app/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ import Link from '../link/Link';
import VisuallyHidden from '../visuallyHidden/VisuallyHidden';
import data from './data';

interface LinkObjectProps {
title: string;
uri: string;
}
interface DataObjectProps {
title: string;
links: LinkObjectProps[];
}

export interface Props {
className?: string;
}
Expand Down Expand Up @@ -61,14 +52,14 @@ const Footer = ({ className }: Props) => {
</div>
</div>
<div className="footer__links">
{data.map((d: DataObjectProps, idx: number) => {
if (!d || !d.links || d.links.length < 1) return null;
{data.map(({ title, links }, i: number) => {
if (!links || links.length < 1) return null;
return (
<FooterColumn
key={`${d.title}-${idx}`}
key={`${title}-${i}`}
className="footer__links-column"
links={d.links}
title={d.title}
links={links}
title={title}
/>
);
})}
Expand Down
12 changes: 6 additions & 6 deletions src/app/components/footer/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default [
links: [
{
title: 'Careers',
uri: 'https://www.zengenti.com/careers',
path: 'https://www.zengenti.com/careers',
},
],
},
Expand All @@ -13,19 +13,19 @@ export default [
links: [
{
title: 'Shipping',
uri: '/about/shipping',
path: '/about/shipping',
},
{
title: 'Returns',
uri: '/about/returns',
path: '/about/returns',
},
{
title: 'Terms and conditions',
uri: '/about/terms-and-conditions',
path: '/about/terms-and-conditions',
},
{
title: 'Privacy and cookies',
uri: '/about/privacy-policy',
path: '/about/privacy-policy',
},
],
},
Expand All @@ -34,7 +34,7 @@ export default [
links: [
{
title: 'Contact',
uri: '/about/contact',
path: '/about/contact',
},
],
},
Expand Down
12 changes: 8 additions & 4 deletions src/app/components/footerColumn/FooterColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FooterColumnStyled from './FooterColumn.styled';

interface LinkObject {
title: string;
uri: string;
path: string;
}

interface Props {
Expand All @@ -30,10 +30,14 @@ const FooterColumn = ({ className, title, links }: Props) => {
</button>
<h3 className="footer-column__title">{title}</h3>
<div className="footer-column__sub-links">
{links.map((l: LinkObject) => {
{links.map((link: LinkObject) => {
return (
<Link className="footer-column__sub-link" key={l.title} uri={l.uri}>
{l.title}
<Link
className="footer-column__sub-link"
key={link.title}
path={link.path}
>
{link.title}
</Link>
);
})}
Expand Down

0 comments on commit f39339d

Please sign in to comment.