mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-18 06:22:25 +03:00
30 lines
675 B
JavaScript
30 lines
675 B
JavaScript
import Document, { Head, Main, NextScript } from "next/document";
|
|
import { extractCritical } from "@emotion/server";
|
|
|
|
export default class MyDocument extends Document {
|
|
static getInitialProps({ renderPage }) {
|
|
const page = renderPage();
|
|
const styles = extractCritical(page.html);
|
|
return { ...page, ...styles };
|
|
}
|
|
|
|
render() {
|
|
const ids = this.props.ids.join(" ");
|
|
|
|
return (
|
|
<html>
|
|
<Head>
|
|
<style
|
|
data-emotion-css={ids}
|
|
dangerouslySetInnerHTML={{ __html: this.props.css }}
|
|
/>
|
|
</Head>
|
|
<body>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
}
|