2016-12-23 19:18:25 +00:00
|
|
|
import Document, { Head, Main, NextScript } from 'next/document'
|
|
|
|
import { renderStatic } from 'glamor/server'
|
|
|
|
|
|
|
|
export default class MyDocument extends Document {
|
|
|
|
static async getInitialProps ({ renderPage }) {
|
|
|
|
const page = renderPage()
|
2018-02-14 17:05:02 +00:00
|
|
|
const styles = renderStatic(() => page.html || page.errorHtml)
|
2016-12-23 19:18:25 +00:00
|
|
|
return { ...page, ...styles }
|
|
|
|
}
|
|
|
|
|
2017-02-26 12:28:00 +00:00
|
|
|
constructor (props) {
|
|
|
|
super(props)
|
|
|
|
const { __NEXT_DATA__, ids } = props
|
|
|
|
if (ids) {
|
|
|
|
__NEXT_DATA__.ids = this.props.ids
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-23 19:18:25 +00:00
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<html>
|
|
|
|
<Head>
|
|
|
|
<style dangerouslySetInnerHTML={{ __html: this.props.css }} />
|
|
|
|
</Head>
|
|
|
|
<body>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|