-
Notifications
You must be signed in to change notification settings - Fork 6.3k
/
DocsLayout.tsx
42 lines (35 loc) · 1.3 KB
/
DocsLayout.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
import { useMemo } from 'react';
import type { FC, PropsWithChildren } from 'react';
import SideNavigation from '@/components/SideNavigation';
import { useNodeReleases } from '@/hooks/useNodeReleases';
import BaseLayout from './BaseLayout';
const DocsLayout: FC<PropsWithChildren> = ({ children }) => {
const { getReleaseByStatus, getLatestIsLtsRelease } = useNodeReleases();
const [lts, current] = useMemo(
() => [getLatestIsLtsRelease(), getReleaseByStatus('Current')],
[getLatestIsLtsRelease, getReleaseByStatus]
);
const translationContext = {
apiLts: {
ltsNodeVersion: lts ? `v${lts.major}.x` : undefined,
fullLtsNodeVersion: lts ? lts.versionWithPrefix : undefined,
spanLts: <span className="small color-lightgray">LTS</span>,
},
apiCurrent: {
fullCurrentNodeVersion: current ? current.versionWithPrefix : undefined,
currentNodeVersion: current ? `v${current.major}.x` : undefined,
},
guides: {
spanGuides: <span className="small color-lightgray">ARCHIVE</span>,
},
};
return (
<BaseLayout>
<div className="has-side-nav container">
<SideNavigation navigationKey="docs" context={translationContext} />
<article dir="auto">{children}</article>
</div>
</BaseLayout>
);
};
export default DocsLayout;