summaryrefslogtreecommitdiffstats
path: root/stepped-solutions/10/frontend/pages
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-06-22 14:23:49 -0400
committerWes Bos <wesbos@gmail.com>2018-06-22 14:23:49 -0400
commit5f2d4ba39a19e2900192a69a58ee211f4eda9a98 (patch)
tree87392a1849f3535b2603acd30eee2e1f9305ff57 /stepped-solutions/10/frontend/pages
parent8d4dffa6f01487be0cf5546653803d32282992eb (diff)
stepped solutions
Diffstat (limited to 'stepped-solutions/10/frontend/pages')
-rw-r--r--stepped-solutions/10/frontend/pages/_document.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/stepped-solutions/10/frontend/pages/_document.js b/stepped-solutions/10/frontend/pages/_document.js
new file mode 100644
index 0000000..0ac8935
--- /dev/null
+++ b/stepped-solutions/10/frontend/pages/_document.js
@@ -0,0 +1,23 @@
+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>{this.props.styleTags}</Head>
+ <body>
+ <Main />
+ <NextScript />
+ </body>
+ </html>
+ );
+ }
+}