security-checklist/pages/_document.js
2019-11-24 19:51:03 -05:00

54 lines
1.3 KiB
JavaScript

// @flow
import * as React from 'react';
import Document, { Head, Main, NextScript } from 'next/document';
import { ServerStyleSheet } from 'styled-components';
export default class MyDocument extends Document {
// $FlowFixMe
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 lang="en">
<Head>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
key="viewport"
/>
<meta charSet="utf-8" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/static/meta/favicon-96x96.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/static/meta/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/static/meta/favicon-16x16.png"
/>
{this.props.styleTags}
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
}