mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-01 18:00:26 +00:00
Add loading between pages
This commit is contained in:
@@ -48,6 +48,17 @@ const Global = createGlobalStyle<Props>`
|
|||||||
color: ${({ dark, theme }) => (dark ? theme.colors.dark.text : theme.colors.light.text)};
|
color: ${({ dark, theme }) => (dark ? theme.colors.dark.text : theme.colors.light.text)};
|
||||||
transition: color 250ms ease-in-out, background 250ms ease-in-out;
|
transition: color 250ms ease-in-out, background 250ms ease-in-out;
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
|
|
||||||
|
#nprogress .bar {
|
||||||
|
background: ${({ dark, theme }) =>
|
||||||
|
dark ? theme.colors.dark.text : theme.colors.light.text} !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nprogress .peg {
|
||||||
|
box-shadow: 0 0 10px ${({ dark, theme }) =>
|
||||||
|
dark ? theme.colors.dark.text : theme.colors.light.text}, 0 0 5px ${({ dark, theme }) =>
|
||||||
|
dark ? theme.colors.dark.text : theme.colors.light.text} !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body::-webkit-scrollbar {
|
body::-webkit-scrollbar {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
"mdx-embed": "^0.0.17",
|
"mdx-embed": "^0.0.17",
|
||||||
"next": "10.0.4",
|
"next": "10.0.4",
|
||||||
"next-mdx-remote": "^2.1.1",
|
"next-mdx-remote": "^2.1.1",
|
||||||
|
"nprogress": "^0.2.0",
|
||||||
"prism-react-renderer": "^1.1.1",
|
"prism-react-renderer": "^1.1.1",
|
||||||
"react": "17.0.1",
|
"react": "17.0.1",
|
||||||
"react-dom": "17.0.1",
|
"react-dom": "17.0.1",
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^14.14.19",
|
"@types/node": "^14.14.19",
|
||||||
|
"@types/nprogress": "^0.2.0",
|
||||||
"@types/react": "^17.0.0",
|
"@types/react": "^17.0.0",
|
||||||
"@types/react-typing-animation": "^1.6.2",
|
"@types/react-typing-animation": "^1.6.2",
|
||||||
"@types/styled-components": "^5.1.7",
|
"@types/styled-components": "^5.1.7",
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import type { AppProps } from 'next/app';
|
import type { AppProps } from 'next/app';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
import Nav from '../components/Nav';
|
import Nav from '../components/Nav';
|
||||||
import DarkMode from '../components/DarkMode';
|
import DarkMode from '../components/DarkMode';
|
||||||
import Container from '../components/Container';
|
import Container from '../components/Container';
|
||||||
@@ -7,7 +11,28 @@ import GlobalStyles from '../components/GlobalStyles';
|
|||||||
import Theme from '../components/Theme';
|
import Theme from '../components/Theme';
|
||||||
import Footer from '../components/Footer';
|
import Footer from '../components/Footer';
|
||||||
|
|
||||||
|
import NProgress from 'nprogress';
|
||||||
|
import 'nprogress/nprogress.css';
|
||||||
|
|
||||||
|
NProgress.configure({ showSpinner: false });
|
||||||
|
|
||||||
const App = ({ Component, pageProps }: AppProps) => {
|
const App = ({ Component, pageProps }: AppProps) => {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
router.events.on('routeChangeStart', () => {
|
||||||
|
NProgress.start();
|
||||||
|
});
|
||||||
|
|
||||||
|
router.events.on('routeChangeComplete', () => {
|
||||||
|
NProgress.done();
|
||||||
|
});
|
||||||
|
|
||||||
|
router.events.on('routeChangeError', () => {
|
||||||
|
NProgress.done();
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
|
|||||||
@@ -1161,6 +1161,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.19.tgz#5135176a8330b88ece4e9ab1fdcfc0a545b4bab4"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.19.tgz#5135176a8330b88ece4e9ab1fdcfc0a545b4bab4"
|
||||||
integrity sha512-4nhBPStMK04rruRVtVc6cDqhu7S9GZai0fpXgPXrFpcPX6Xul8xnrjSdGB4KPBVYG/R5+fXWdCM8qBoiULWGPQ==
|
integrity sha512-4nhBPStMK04rruRVtVc6cDqhu7S9GZai0fpXgPXrFpcPX6Xul8xnrjSdGB4KPBVYG/R5+fXWdCM8qBoiULWGPQ==
|
||||||
|
|
||||||
|
"@types/nprogress@^0.2.0":
|
||||||
|
version "0.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/nprogress/-/nprogress-0.2.0.tgz#86c593682d4199212a0509cc3c4d562bbbd6e45f"
|
||||||
|
integrity sha512-1cYJrqq9GezNFPsWTZpFut/d4CjpZqA0vhqDUPFWYKF1oIyBz5qnoYMzR+0C/T96t3ebLAC1SSnwrVOm5/j74A==
|
||||||
|
|
||||||
"@types/parse5@^5.0.0":
|
"@types/parse5@^5.0.0":
|
||||||
version "5.0.3"
|
version "5.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109"
|
resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109"
|
||||||
|
|||||||
Reference in New Issue
Block a user