Skip to content

Commit a55083c

Browse files
committed
Add loading indicator during page load
Add visual feedback during page load
1 parent 38b09d5 commit a55083c

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"graphql-request": "^2.0.0",
2525
"graphql-tag": "^2.10.3",
2626
"next": "^9.4.4",
27+
"nprogress": "^0.2.0",
2728
"react": "^16.13.1",
2829
"react-dom": "^16.13.1",
2930
"react-instantsearch-dom": "^6.6.0",

pages/_app.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
import { ApolloProvider } from '@apollo/react-hooks';
2-
32
import { AppProvider } from 'utils/context/AppContext';
43

4+
import Router from 'next/router';
5+
import NProgress from 'nprogress';
6+
57
import Header from '../components/Header/Header.component';
68
import Footer from '../components/Footer/Footer.component';
79

810
import '../styles/index.css';
911
import '../styles/algolia.min.css';
12+
import 'nprogress/nprogress.css';
1013

1114
import client from '../utils/apollo/ApolloClient';
1215

16+
Router.events.on('routeChangeStart', () => NProgress.start());
17+
Router.events.on('routeChangeComplete', () => NProgress.done());
18+
Router.events.on('routeChangeError', () => NProgress.done());
19+
1320
const App = ({ Component, pageProps }) => {
1421
return (
1522
<>

utils/const/INITIAL_STATE.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const INITIAL_STATE = {
1212
country: 'NO',
1313
postcode: '1525',
1414
phone: '90561212',
15-
email: 'test@gmail.com',
15+
email: 'test@testemailgmail.com',
1616
company: 'Tech',
1717
createAccount: false,
1818
orderNotes: '',

0 commit comments

Comments
 (0)