-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path_document.tsx
More file actions
56 lines (48 loc) · 1.39 KB
/
_document.tsx
File metadata and controls
56 lines (48 loc) · 1.39 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
import Document, {
DocumentContext,
Head,
Html,
Main,
NextScript,
} from 'next/document';
import { LanguageCode, parseSSRContext } from '../models/Translation';
interface CustomDocumentProps {
language: LanguageCode;
colorScheme: 'light' | 'dark';
}
export default class CustomDocument extends Document<CustomDocumentProps> {
static async getInitialProps(context: DocumentContext) {
return {
...(await Document.getInitialProps(context)),
...parseSSRContext<CustomDocumentProps>(context, ['language']),
};
}
render() {
const { language, colorScheme } = this.props;
return (
<Html lang={language} data-bs-theme={colorScheme}>
<Head>
<link rel="icon" href="/favicon.ico" />
<link rel="manifest" href="/manifest.json" />
<script src="https://polyfill.web-cell.dev/feature/PWAManifest.js" />
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap@5.3.6/dist/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap-icons@1.13.1/font/bootstrap-icons.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/github-markdown-css@5.8.1/github-markdown.css"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}