選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

88 行
2.9 KiB

  1. /*!
  2. =========================================================
  3. * NextJS Material Kit v1.1.0 based on Material Kit Free - v2.0.2 (Bootstrap 4.0.0 Final Edition) and Material Kit React v1.8.0
  4. =========================================================
  5. * Product Page: https://www.creative-tim.com/product/nextjs-material-kit
  6. * Copyright 2020 Creative Tim (https://www.creative-tim.com)
  7. * Licensed under MIT (https://github.com/creativetimofficial/nextjs-material-kit/blob/master/LICENSE.md)
  8. * Coded by Creative Tim
  9. =========================================================
  10. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  11. */
  12. import React from "react";
  13. import ReactDOM from "react-dom";
  14. import App from "next/app";
  15. import Head from "next/head";
  16. import Router from "next/router";
  17. import PageChange from "components/PageChange/PageChange.js";
  18. import "assets/scss/nextjs-material-kit.scss?v=1.1.0";
  19. Router.events.on("routeChangeStart", url => {
  20. console.log(`Loading: ${url}`);
  21. document.body.classList.add("body-page-transition");
  22. ReactDOM.render(
  23. <PageChange path={url} />,
  24. document.getElementById("page-transition")
  25. );
  26. });
  27. Router.events.on("routeChangeComplete", () => {
  28. ReactDOM.unmountComponentAtNode(document.getElementById("page-transition"));
  29. document.body.classList.remove("body-page-transition");
  30. });
  31. Router.events.on("routeChangeError", () => {
  32. ReactDOM.unmountComponentAtNode(document.getElementById("page-transition"));
  33. document.body.classList.remove("body-page-transition");
  34. });
  35. export default class MyApp extends App {
  36. componentDidMount() {
  37. let comment = document.createComment(`
  38. =========================================================
  39. * NextJS Material Kit v1.1.0 based on Material Kit Free - v2.0.2 (Bootstrap 4.0.0 Final Edition) and Material Kit React v1.8.0
  40. =========================================================
  41. * Product Page: https://www.creative-tim.com/product/nextjs-material-kit
  42. * Copyright 2020 Creative Tim (https://www.creative-tim.com)
  43. * Licensed under MIT (https://github.com/creativetimofficial/nextjs-material-kit/blob/master/LICENSE.md)
  44. * Coded by Creative Tim
  45. =========================================================
  46. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  47. `);
  48. document.insertBefore(comment, document.documentElement);
  49. }
  50. static async getInitialProps({ Component, router, ctx }) {
  51. let pageProps = {};
  52. if (Component.getInitialProps) {
  53. pageProps = await Component.getInitialProps(ctx);
  54. }
  55. return { pageProps };
  56. }
  57. render() {
  58. const { Component, pageProps } = this.props;
  59. return (
  60. <React.Fragment>
  61. <Head>
  62. <title>Thamrin Group</title>
  63. </Head>
  64. <Component {...pageProps} />
  65. </React.Fragment>
  66. );
  67. }
  68. }