File tree 4 files changed +110
-1
lines changed
4 files changed +110
-1
lines changed Original file line number Diff line number Diff line change 10
10
"dependencies" : {
11
11
"axios" : " ^0.21.1" ,
12
12
"next" : " 11.0.1" ,
13
+ "nprogress" : " ^0.2.0" ,
13
14
"react" : " 17.0.2" ,
14
15
"react-dom" : " 17.0.2"
15
16
}
Original file line number Diff line number Diff line change 1
1
import React from "react"
2
2
import Head from "next/head"
3
- import { useRouter } from "next/router"
3
+ import Router , { useRouter } from "next/router"
4
4
import Navbar from "../components/Navbar"
5
5
import Footer from "../components/Footer"
6
6
@@ -11,6 +11,21 @@ import '../styles/Navbar.css'
11
11
import '../styles/Footer.css'
12
12
import '../styles/contact.css'
13
13
import '../styles/globals.css'
14
+ import '../styles/nprogress.css'
15
+
16
+
17
+ import NProgress from 'nprogress' ;
18
+
19
+ NProgress . configure ( { easing : 'ease' , speed : 1000 } ) ;
20
+ Router . onRouteChangeStart = ( ) => {
21
+ NProgress . start ( ) ;
22
+ } ;
23
+ Router . onRouteChangeComplete = ( ) => {
24
+ NProgress . done ( ) ;
25
+ } ;
26
+ Router . onRouteChangeError = ( ) => {
27
+ NProgress . done ( ) ;
28
+ } ;
14
29
15
30
16
31
let excludes = [ "/app/run" ]
Original file line number Diff line number Diff line change
1
+ /* Make clicks pass-through */
2
+
3
+ # nprogress {
4
+ pointer-events : none;
5
+ }
6
+
7
+ # nprogress .bar {
8
+ background : # fc7 ;
9
+ position : fixed;
10
+ z-index : 1031 ;
11
+ top : 0 ;
12
+ left : 0 ;
13
+ width : 100% ;
14
+ height : 5px ;
15
+ }
16
+
17
+
18
+ /* Fancy blur effect */
19
+
20
+ # nprogress .peg {
21
+ display : block;
22
+ position : absolute;
23
+ right : 0px ;
24
+ width : 100px ;
25
+ height : 100% ;
26
+ box-shadow : 0 0 10px # fc7, 0 0 5px # fc7 ;
27
+ opacity : 1.0 ;
28
+ -webkit-transform : rotate (3deg ) translate (0px , -4px );
29
+ -ms-transform : rotate (3deg ) translate (0px , -4px );
30
+ transform : rotate (3deg ) translate (0px , -4px );
31
+ }
32
+
33
+
34
+ /* Remove these to get rid of the spinner */
35
+
36
+ # nprogress .spinner {
37
+ display : block;
38
+ position : fixed;
39
+ z-index : 1031 ;
40
+ top : 15px ;
41
+ right : 15px ;
42
+ }
43
+
44
+ # nprogress .spinner-icon {
45
+ width : 18px ;
46
+ height : 18px ;
47
+ box-sizing : border-box;
48
+ border : solid 2px transparent;
49
+ border-top-color : # fc7 ;
50
+ border-left-color : # fc7 ;
51
+ border-radius : 50% ;
52
+ -webkit-animation : nprogress-spinner 400ms linear infinite;
53
+ animation : nprogress-spinner 400ms linear infinite;
54
+ }
55
+
56
+ .nprogress-custom-parent {
57
+ overflow : hidden;
58
+ position : relative;
59
+ }
60
+
61
+ .nprogress-custom-parent # nprogress .spinner ,
62
+ .nprogress-custom-parent # nprogress .bar {
63
+ position : absolute;
64
+ }
65
+
66
+ @-webkit-keyframes nprogress-spinner {
67
+ 0% {
68
+ -webkit-transform : rotate (0deg );
69
+ }
70
+ 100% {
71
+ -webkit-transform : rotate (360deg );
72
+ }
73
+ }
74
+
75
+ @keyframes nprogress-spinner {
76
+ 0% {
77
+ transform : rotate (0deg );
78
+ }
79
+ 100% {
80
+ transform : rotate (360deg );
81
+ }
82
+ }
You can’t perform that action at this time.
0 commit comments