Permalink
Newer
100644
58 lines (55 sloc)
1.75 KB
1
/* eslint-disable flowtype/require-valid-file-annotation */
2
3
import React from 'react';
4
import Document, { Head, Main, NextScript } from 'next/document';
5
import { getContext } from '../styles/context';
6
7
export default class MyDocument extends Document {
8
static getInitialProps(ctx) {
9
const page = ctx.renderPage();
10
// Get the context with the collected side effects.
11
const context = getContext();
12
return {
13
...page,
14
styles: (
15
<style
16
id="jss-server-side"
17
// eslint-disable-next-line react/no-danger
18
dangerouslySetInnerHTML={{ __html: context.sheetsRegistry.toString() }}
19
/>
20
),
21
};
22
}
23
24
render() {
25
const context = getContext();
26
return (
27
<html lang="en">
28
<Head>
29
<title>My page</title>
30
<meta charSet="utf-8" />
31
{/* Use minimum-scale=1 to enable GPU rasterization */}
32
<meta
33
name="viewport"
34
content={
35
'user-scalable=0, initial-scale=1, ' +
36
'minimum-scale=1, width=device-width, height=device-height'
37
}
38
/>
39
{/*
40
manifest.json provides metadata used when your web app is added to the
41
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
42
*/}
43
<link rel="manifest" href="/static/manifest.json" />
44
{/* PWA primary color */}
45
<meta name="theme-color" content={context.theme.palette.primary[500]} />
46
<link
47
rel="stylesheet"
48
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
49
/>
50
</Head>
51
<body>
52
<Main />
53
<NextScript />
54
</body>
55
</html>
56
);
57
}
58
}