2017-04-06 00:54:42 +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)
|
2017-04-06 00:54:42 +00:00
|
|
|
return { ...page, ...styles }
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor (props) {
|
|
|
|
super(props)
|
|
|
|
const { __NEXT_DATA__, ids } = props
|
|
|
|
if (ids) {
|
|
|
|
__NEXT_DATA__.ids = this.props.ids
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<html>
|
|
|
|
<Head>
|
|
|
|
<style dangerouslySetInnerHTML={{ __html: this.props.css }} />
|
|
|
|
</Head>
|
|
|
|
<body>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|