57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
import getUrls from 'config/urls';
|
|
import Document, { Head, Html, Main, NextScript } from 'next/document';
|
|
import { ServerStyleSheet } from 'styled-components';
|
|
|
|
const { BASE_PATH } = getUrls();
|
|
|
|
export default class MyDocument extends Document {
|
|
static async getInitialProps(ctx) {
|
|
const sheet = new ServerStyleSheet();
|
|
const originalRenderPage = ctx.renderPage;
|
|
|
|
try {
|
|
// prettier-ignore
|
|
ctx.renderPage = () => originalRenderPage({
|
|
enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),
|
|
});
|
|
|
|
const initialProps = await Document.getInitialProps(ctx);
|
|
|
|
return {
|
|
...initialProps,
|
|
styles: (
|
|
<>
|
|
{initialProps.styles}
|
|
{sheet.getStyleElement()}
|
|
</>
|
|
),
|
|
};
|
|
} finally {
|
|
sheet.seal();
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html lang="ru" translate="no">
|
|
<Head>
|
|
<meta charSet="utf-8" />
|
|
<meta name="theme-color" content="#000000" />
|
|
<meta name="description" content="Лизинговый калькулятор Эволюция" />
|
|
<link rel="apple-touch-icon" sizes="180x180" href={`${BASE_PATH}/apple-touch-icon.png`} />
|
|
<link rel="icon" type="image/png" sizes="32x32" href={`${BASE_PATH}/favicon-32x32.png`} />
|
|
<link rel="icon" type="image/png" sizes="16x16" href={`${BASE_PATH}/favicon-16x16.png`} />
|
|
<link rel="manifest" href={`${BASE_PATH}/site.webmanifest`} />
|
|
<link rel="mask-icon" href={`${BASE_PATH}/safari-pinned-tab.svg`} color="#5bbad5" />
|
|
<meta name="msapplication-TileColor" content="#da532c" />
|
|
<meta name="theme-color" content="#ffffff" />
|
|
</Head>
|
|
<body>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
);
|
|
}
|
|
}
|