2021-05-09 21:22:25 +00:00
|
|
|
import NextDocument, { Html, Head, Main, NextScript } from "next/document"
|
|
|
|
import { dark, getCssString } from "styles"
|
2021-05-09 12:03:39 +00:00
|
|
|
|
2021-05-09 21:22:25 +00:00
|
|
|
class MyDocument extends NextDocument {
|
|
|
|
static async getInitialProps(ctx) {
|
|
|
|
try {
|
|
|
|
const initialProps = await NextDocument.getInitialProps(ctx)
|
|
|
|
|
|
|
|
return {
|
|
|
|
...initialProps,
|
|
|
|
styles: (
|
|
|
|
<>
|
|
|
|
{initialProps.styles}
|
|
|
|
<style
|
|
|
|
id="stitches"
|
|
|
|
dangerouslySetInnerHTML={{ __html: getCssString() }}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e.message)
|
|
|
|
} finally {
|
|
|
|
}
|
2021-05-09 12:03:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2021-05-09 21:22:25 +00:00
|
|
|
<Html lang="en">
|
2021-05-09 13:04:42 +00:00
|
|
|
<Head />
|
2021-05-09 12:03:39 +00:00
|
|
|
<body className={dark}>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</Html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MyDocument
|