2018-09-12 13:49:54 +00:00
|
|
|
import React from 'react'
|
|
|
|
import Document, { Head, Main, NextScript } from 'next/document'
|
2018-12-17 16:34:32 +00:00
|
|
|
import { SheetsRegistry, JssProvider } from 'react-jss'
|
2018-09-12 13:49:54 +00:00
|
|
|
|
|
|
|
export default class JssDocument extends Document {
|
|
|
|
static getInitialProps (ctx) {
|
|
|
|
const registry = new SheetsRegistry()
|
|
|
|
const page = ctx.renderPage(App => props => (
|
|
|
|
<JssProvider registry={registry}>
|
|
|
|
<App {...props} />
|
|
|
|
</JssProvider>
|
|
|
|
))
|
|
|
|
|
|
|
|
return {
|
|
|
|
...page,
|
|
|
|
registry
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<html>
|
|
|
|
<Head>
|
|
|
|
<style id='server-side-styles'>
|
|
|
|
{this.props.registry.toString()}
|
|
|
|
</style>
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|