forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwithFooter.tsx
More file actions
31 lines (23 loc) · 845 Bytes
/
withFooter.tsx
File metadata and controls
31 lines (23 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use client';
import Footer from '@node-core/ui-components/Containers/Footer';
import { useTranslations } from 'next-intl';
import type { FC } from 'react';
import Link from '#site/components/Link';
import { usePathname } from '#site/navigation.mjs';
import { siteNavigation } from '#site/next.json.mjs';
const WithFooter: FC = () => {
const t = useTranslations();
const pathname = usePathname();
const { socialLinks, footerLinks } = siteNavigation;
const updatedFooterLinks = footerLinks
.slice(0, -1)
.map(link => ({ ...link, text: t(link.text) }));
// Add OpenJS link
updatedFooterLinks.push(footerLinks.at(-1)!);
const navigation = {
socialLinks: socialLinks,
footerLinks: updatedFooterLinks,
};
return <Footer navigation={navigation} as={Link} pathname={pathname} />;
};
export default WithFooter;