tldraw/pages/_document.tsx

41 lines
830 B
TypeScript
Raw Normal View History

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) {
2021-05-25 09:09:51 +00:00
console.error(e.message)
2021-05-09 21:22:25 +00:00
} 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