Ringtone app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 regels
857 B

  1. import Document, {Html, Head, Main, NextScript} from 'next/document';
  2. import {ServerStyleSheet} from 'styled-components';
  3. export default class MyDocument extends Document {
  4. static async getInitialProps(ctx) {
  5. const sheet = new ServerStyleSheet();
  6. const originalRenderPage = ctx.renderPage;
  7. try {
  8. ctx.renderPage = () =>
  9. originalRenderPage({
  10. enhanceApp: (App) => (props) =>
  11. sheet.collectStyles(
  12. <App
  13. {...props}
  14. />,
  15. ),
  16. });
  17. const initialProps = await Document.getInitialProps(ctx);
  18. return {
  19. ...initialProps,
  20. styles: (
  21. <>
  22. {initialProps.styles}
  23. {sheet.getStyleElement()}
  24. </>
  25. ),
  26. };
  27. } catch (err) {
  28. console.error(err);
  29. } finally {
  30. sheet.seal();
  31. }
  32. }
  33. render() {
  34. return (
  35. <Html
  36. lang="en-PH"
  37. >
  38. <Head />
  39. <body>
  40. <Main />
  41. <NextScript />
  42. </body>
  43. </Html>
  44. );
  45. }
  46. }