{"size": 3053, "ext": "js", "max_stars_repo_path": "pages/_document.js", "max_stars_repo_name": "atanasster/crypto-grommet", "max_stars_repo_stars_event_min_datetime": "2018-02-07T18:21:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-15T02:45:25.000Z", "max_issues_repo_path": "pages/_document.js", "max_issues_repo_name": "atanasster/crypto-grommet", "max_issues_repo_issues_event_min_datetime": "2018-05-24T09:50:26.000Z", "max_issues_repo_issues_event_max_datetime": "2018-05-25T04:04:32.000Z", "max_forks_repo_path": "pages/_document.js", "max_forks_repo_name": "atanasster/crypto-grommet", "max_forks_repo_forks_event_min_datetime": "2018-05-13T08:27:54.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-17T03:39:49.000Z"}
{"max_stars_count": 40, "max_issues_count": 1, "max_forks_count": 5, "avg_line_length": 48.4603174603, "max_line_length": 116, "alphanum_fraction": 0.6203734032}
import React from 'react';
import Document, { Head, Main, NextScript } from 'next/document';
import { ServerStyleSheet } from 'styled-components';
import htmlescape from 'htmlescape';

const { GRAPHQL_SERVER } = process.env;
const env = { GRAPHQL_SERVER };

export default class MyDocument extends Document {
  static async getInitialProps(ctx) {
    const sheet = new ServerStyleSheet();

    const originalRenderPage = ctx.renderPage;
    ctx.renderPage = () =>
      originalRenderPage({
        enhanceApp: App => props => sheet.collectStyles(<App {...props} />),
      });

    const initialProps = await Document.getInitialProps(ctx);
    return {
      ...initialProps,
      styles: [...initialProps.styles, ...sheet.getStyleElement()],
    };
  }

  render() {
    return (
      <html lang='en-US'>
        <Head>
          <meta name='viewport' content='width=device-width,initial-scale=1' />
          <meta name='fragment' content='!' />
          <meta name='mobile-web-app-capable' content='yes' />
          <meta httpEquiv='X-UA-Compatible' content='IE=edge' />
          <link rel='apple-touch-icon' sizes='57x57' type='image/png' href='/static/img/apple-icon-57x57.png' />
          <link rel='apple-touch-icon' sizes='60x60' type='image/png' href='/static/img/apple-icon-60x60.png' />
          <link rel='apple-touch-icon' sizes='72x72' type='image/png' href='/static/img/apple-icon-72x72.png' />
          <link rel='apple-touch-icon' sizes='76x76' type='image/png' href='/static/img/apple-icon-76x76.png' />
          <link rel='apple-touch-icon' sizes='114x114' type='image/png' href='/static/img/apple-icon-114x114.png' />
          <link rel='apple-touch-icon' sizes='120x120' type='image/png' href='/static/img/apple-icon-120x120.png' />
          <link rel='apple-touch-icon' sizes='144x144' type='image/png' href='/static/img/apple-icon-144x144.png' />
          <link rel='apple-touch-icon' sizes='152x152' type='image/png' href='/static/img/apple-icon-152x152.png' />
          <link rel='apple-touch-icon' sizes='180x180' type='image/png' href='/static/img/apple-icon-180x180.png' />
          <link rel='icon' sizes='192x192' type='image/png' href='/static/img/android-icon-192x192.png' />
          <link rel='icon' sizes='32x32' type='image/png' href='/static/img/favicon-32x32.png' />
          <link rel='icon' sizes='96x96' type='image/png' href='/static/img/favicon-96x96.png' />
          <link rel='icon' sizes='16x16' type='image/png' href='/static/img/favicon-16x16.png' />
          <link rel='manifest' href='/static/img/manifest.json' />
          <meta name='msapplication-TileColor' content='#ffffff' />
          <meta name='msapplication-TileImage' content='/static/img/ms-icon-144x144.png' />
          <meta name='theme-color' content='#ffffff' />
        </Head>
        <body style={{ margin: 0 }} >
          <Main />
          <script
            dangerouslySetInnerHTML={{ __html: `__ENV__ = ${htmlescape(env)}` }}
          />
          <NextScript />
        </body>
      </html>
    );
  }
}
