forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDownloadLayout.tsx
51 lines (43 loc) · 1.42 KB
/
DownloadLayout.tsx
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
import type { FC, PropsWithChildren } from 'react';
import PrimaryDownloadMatrix from '@/components/Downloads/PrimaryDownloadMatrix';
import SecondaryDownloadMatrix from '@/components/Downloads/SecondaryDownloadMatrix';
import WithNodeRelease from '@/components/withNodeRelease';
import { useClientContext } from '@/hooks/server';
const DownloadLayout: FC<PropsWithChildren> = ({ children }) => {
const {
frontmatter: { downloads },
pathname,
} = useClientContext();
const isCurrentReleasePage = pathname.includes('/current');
return (
<div className="container">
<article dir="auto">
<div className="download-header">
<h1>{downloads.headline}</h1>
</div>
{children}
{isCurrentReleasePage && (
<WithNodeRelease status="Current">
{({ release }) => (
<>
<PrimaryDownloadMatrix {...release} />
<SecondaryDownloadMatrix {...release} />
</>
)}
</WithNodeRelease>
)}
{isCurrentReleasePage || (
<WithNodeRelease status={['Active LTS', 'Maintenance LTS']}>
{({ release }) => (
<>
<PrimaryDownloadMatrix {...release} />
<SecondaryDownloadMatrix {...release} />
</>
)}
</WithNodeRelease>
)}
</article>
</div>
);
};
export default DownloadLayout;