App for making pecha kucha presentations.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

59 lignes
1.6 KiB

  1. import * as React from 'react'
  2. import Document, {Html, Head, Main, NextScript, DocumentInitialProps, DocumentContext} from 'next/document'
  3. import {ServerStyleSheet} from 'styled-components'
  4. import pkg from '../../package.json'
  5. import config from '../../next.config'
  6. const publicUrl = process.env.NODE_ENV === 'production' ? pkg.homepage : config.basePath
  7. export default class MyDocument extends Document {
  8. static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
  9. const sheet = new ServerStyleSheet()
  10. const originalRenderPage = ctx.renderPage
  11. try {
  12. ctx.renderPage = () =>
  13. originalRenderPage({
  14. enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),
  15. })
  16. const initialProps = await Document.getInitialProps(ctx)
  17. return {
  18. ...initialProps,
  19. styles: (
  20. <>
  21. {initialProps.styles}
  22. <link rel="preconnect" href="https://fonts.gstatic.com" />
  23. <link
  24. rel="stylesheet"
  25. href="https://fonts.googleapis.com/css2?family=Encode+Sans:wdth,wght@75..112.5,100..900&display=swap"
  26. />
  27. <link rel="stylesheet" href={`${publicUrl}/global.css`} />
  28. <link rel="stylesheet" href={`${publicUrl}/theme.css`} />
  29. <link rel="stylesheet" title="Dark" href={`${publicUrl}/theme/dark.css`} />
  30. <link rel="alternate stylesheet" title="Light" href={`${publicUrl}/theme/light.css`} />
  31. {sheet.getStyleElement()}
  32. </>
  33. ),
  34. }
  35. } catch (err) {
  36. console.error(err)
  37. } finally {
  38. sheet.seal()
  39. }
  40. }
  41. render(): React.ReactElement {
  42. return (
  43. <Html lang="en-PH">
  44. <Head />
  45. <body>
  46. <Main />
  47. <NextScript />
  48. </body>
  49. </Html>
  50. )
  51. }
  52. }