-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathwithFooter.tsx
More file actions
69 lines (58 loc) · 1.85 KB
/
withFooter.tsx
File metadata and controls
69 lines (58 loc) · 1.85 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import BadgeGroup from '@node-core/ui-components/Common/BadgeGroup';
import Footer from '@node-core/ui-components/Containers/Footer';
import { getTranslations } from 'next-intl/server';
import type { FC } from 'react';
import { getClientContext } from '#site/client-context';
import Link from '#site/components/Link';
import { siteNavigation } from '#site/next.json.mjs';
import WithNodeRelease from './withNodeRelease';
const WithFooter: FC = async () => {
const t = await getTranslations();
const { pathname } = getClientContext();
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,
};
const primary = (
<div className="flex flex-row gap-2">
<WithNodeRelease status="Active LTS">
{({ release }) => (
<BadgeGroup
size="small"
kind="info"
badgeText={release.versionWithPrefix}
href={`/blog/release/${release.versionWithPrefix}`}
>
{t('components.containers.footer.releasePills.latestLTS')}
</BadgeGroup>
)}
</WithNodeRelease>
<WithNodeRelease status="Current">
{({ release }) => (
<BadgeGroup
size="small"
badgeText={release.versionWithPrefix}
href={`/blog/release/${release.versionWithPrefix}`}
>
{t('components.containers.footer.releasePills.latestRelease')}
</BadgeGroup>
)}
</WithNodeRelease>
</div>
);
return (
<Footer
navigation={navigation}
as={Link}
pathname={pathname}
slots={{ primary }}
/>
);
};
export default WithFooter;