Skip to content

Commit 6025cab

Browse files
committed
Add nprogress'
1 parent 01fe5ef commit 6025cab

File tree

8 files changed

+39
-8
lines changed

8 files changed

+39
-8
lines changed

package-lock.json

Lines changed: 11 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
@@ -20,6 +20,7 @@
2020
"next": "^12.3.0",
2121
"next-seo": "^5.15.0",
2222
"next-stripe": "^1.0.0-beta.9",
23+
"nprogress": "^0.2.0",
2324
"prop-types": "^15.8.1",
2425
"react": "^18.2.0",
2526
"react-dom": "^18.2.0",

pages/_app.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import '../src/styles/index.scss'
1+
import '../src/styles/index.scss';
2+
3+
import Router from 'next/router';
4+
import NProgress from 'nprogress';
5+
6+
NProgress.configure( { showSpinner: false } );
7+
Router.events.on( 'routeChangeStart', () => NProgress.start() );
8+
Router.events.on( 'routeChangeComplete', () => NProgress.done() );
9+
Router.events.on( 'routeChangeError', () => NProgress.done() );
210

311
function MyApp({ Component, pageProps }) {
412
return <Component {...pageProps} />

pages/blog/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ import { getPosts } from '../../src/utils/blog';
1919
* @param {Object} postsData Post Data.
2020
*/
2121
const Blog = ( { headerFooter, postsData } ) => {
22-
console.log( 'postsData', postsData );
2322
return (
24-
<Layout headerFooter={ headerFooter || {} } seo={null}>
23+
<Layout headerFooter={ headerFooter || {} } seo={ null }>
2524
<h1>Blog</h1>
26-
<Posts posts={postsData?.posts_data ?? []}/>
27-
<Pagination pagesCount={postsData?.page_count} postName="blog" />
25+
<Posts posts={ postsData?.posts_data ?? [] }/>
26+
<Pagination pagesCount={ postsData?.page_count } postName="blog"/>
2827
</Layout>
2928
);
3029
};
@@ -38,7 +37,7 @@ export async function getStaticProps() {
3837
return {
3938
props: {
4039
headerFooter: headerFooterData?.data ?? {},
41-
postsData: postsData || {}
40+
postsData: postsData || {},
4241
},
4342

4443
/**

pages/blog/page/[pageNo].js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import Pagination from '../../../src/components/pagination';
1818
const Page = ( { headerFooter, postsData } ) => {
1919
const router = useRouter();
2020

21-
console.log( 'postsData', postsData );
22-
2321
// Redirecting to /blog if we are on page 1
2422
const pageNo = router?.query?.pageNo ?? 1;
2523

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// NProgress style.
2+
@import 'nprogress/nprogress.css';
3+
4+
#nprogress .bar {
5+
background-color: #fff;
6+
}

src/styles/index.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010

1111
// Image Gallery Styles.
1212
@import "~react-image-gallery/styles/scss/image-gallery.scss";
13+
14+
// NProgress Styles.
15+
@import "04-libraries/nprogress";

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,11 @@
16291629
"resolved" "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz"
16301630
"version" "0.1.2"
16311631

1632+
"nprogress@^0.2.0":
1633+
"integrity" "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA=="
1634+
"resolved" "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz"
1635+
"version" "0.2.0"
1636+
16321637
"nth-check@^1.0.2":
16331638
"integrity" "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg=="
16341639
"resolved" "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz"

0 commit comments

Comments
 (0)