-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_document.js
49 lines (45 loc) · 1.02 KB
/
_document.js
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
import Document, { Head, Main, NextScript } from 'next/document'
import { ServerStyleSheet, injectGlobal } from 'styled-components'
injectGlobal`
html,
body {
padding: 0;
margin: 0;
text-rendering: optimizeSpeed;
font-family: 'roboto';
}
*,
*:after,
*:before {
box-sizing: border-box;
font-family: 'roboto';
}
`
export default class MyDocument extends Document {
static getInitialProps({ renderPage }) {
const sheet = new ServerStyleSheet()
const page = renderPage(App => props =>
sheet.collectStyles(<App {...props} />),
)
const styleTags = sheet.getStyleElement()
return { ...page, styleTags }
}
render() {
return (
<html>
<head>
<title>CrypTubers</title>
<link
href="https://fonts.googleapis.com/css?family=Roboto:400,500,700"
rel="stylesheet"
/>
{this.props.styleTags}
</head>
<body>
<Main />
<NextScript />
</body>
</html>
)
}
}