Skip to content

Commit

Permalink
fix routing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
maisamaf committed Aug 22, 2023
1 parent cf8bd29 commit 161d474
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
=========================================================
* NextJS Material Kit v1.2.1 based on Material Kit Free - v2.0.2 (Bootstrap 4.0.0 Final Edition) and Material Kit React v1.8.0
* NextJS Material Kit v1.2.2 based on Material Kit Free - v2.0.2 (Bootstrap 4.0.0 Final Edition) and Material Kit React v1.8.0
=========================================================
* Product Page: https://www.creative-tim.com/product/nextjs-material-kit
* Copyright 2022 Creative Tim (https://www.creative-tim.com)
* Copyright 2023 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT (https://github.com/creativetimofficial/nextjs-material-kit/blob/main/LICENSE.md)
* Coded by Creative Tim
Expand All @@ -16,42 +16,20 @@
*/
import React from "react";
import ReactDOM from "react-dom";
import App from "next/app";
import Head from "next/head";
import Router from "next/router";

import PageChange from "/components/PageChange/PageChange.js";

import "/styles/scss/nextjs-material-kit.scss?v=1.2.0";

Router.events.on("routeChangeStart", (url) => {
console.log(`Loading: ${url}`);
document.body.classList.add("body-page-transition");
ReactDOM.render(
<PageChange path={url} />,
document.getElementById("page-transition")
);
});
Router.events.on("routeChangeComplete", () => {
ReactDOM.unmountComponentAtNode(document.getElementById("page-transition"));
document.body.classList.remove("body-page-transition");
});
Router.events.on("routeChangeError", () => {
ReactDOM.unmountComponentAtNode(document.getElementById("page-transition"));
document.body.classList.remove("body-page-transition");
});

export default class MyApp extends App {
componentDidMount() {
let comment = document.createComment(`
=========================================================
* NextJS Material Kit v1.2.1 based on Material Kit Free - v2.0.2 (Bootstrap 4.0.0 Final Edition) and Material Kit React v1.8.0
* NextJS Material Kit v1.2.2 based on Material Kit Free - v2.0.2 (Bootstrap 4.0.0 Final Edition) and Material Kit React v1.8.0
=========================================================
* Product Page: https://www.creative-tim.com/product/nextjs-material-kit
* Copyright 2022 Creative Tim (https://www.creative-tim.com)
* Copyright 2023 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT (https://github.com/creativetimofficial/nextjs-material-kit/blob/main/LICENSE.md)
* Coded by Creative Tim
Expand Down

0 comments on commit 161d474

Please sign in to comment.