summaryrefslogtreecommitdiffstats
path: root/frontend/pages/_document.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-02-15 16:59:58 -0500
committerWes Bos <wesbos@gmail.com>2018-02-15 16:59:58 -0500
commit8f2c595eca30e2d7138c8e8d6685774a8f44e55d (patch)
tree3408b9c8eb3b0ea43cb72e13e0bd6393ab5bac61 /frontend/pages/_document.js
parenta09b01abf7c03e6b7e43f2175e5a34501808821b (diff)
omg
Diffstat (limited to 'frontend/pages/_document.js')
-rw-r--r--frontend/pages/_document.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/frontend/pages/_document.js b/frontend/pages/_document.js
new file mode 100644
index 0000000..e9a6570
--- /dev/null
+++ b/frontend/pages/_document.js
@@ -0,0 +1,26 @@
+import Document, { Head, Main, NextScript } from 'next/document';
+import { ServerStyleSheet } from 'styled-components';
+
+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>My page</title>
+ {this.props.styleTags}
+ </Head>
+ <body>
+ <Main />
+ <NextScript />
+ </body>
+ </html>
+ );
+ }
+}