import Document, { Head, Main, NextScript } from "next/document"; import { ServerStyleSheet } from "styled-components"; import getConfig from "next/config"; import React from "react"; import { Colors } from "../consts"; const { publicRuntimeConfig } = getConfig(); interface Props { styleTags: any; } class AppDocument extends Document { static async getInitialProps(ctx) { const initialProps = await Document.getInitialProps(ctx); const sheet = new ServerStyleSheet(); const page = ctx.renderPage( (App) => (props) => sheet.collectStyles() ); const styleTags = sheet.getStyleElement(); return { ...initialProps, ...page, styleTags }; } render() { return ( {this.props.styleTags}