Skip to content

Commit

Permalink
Implementing a slim progress bar at the top of the header using nprog…
Browse files Browse the repository at this point in the history
…ress npm package
  • Loading branch information
pramit-marattha committed Jan 14, 2021
1 parent 844d597 commit 4d78c7a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ Entire commit History
| 760da6143c39aee8559bde8c84baa3ce7b5ff644 | Adding dashboard link for both admin and user in navigation header |
| c9686aaedffc1a924ddebd3b55f32bc8bc86ba8e | creating categorySchema model and category controller in the backend |
| ea2010997bb0e6fab23d902773e34c0851a104fe | Handling errors and avoiding duplicate category |
| 76bc2bdb0594c674d8f5d43aeea817f5516d6944 | creating,listing,reading and deleting category |
| 844d59771007e67414d916364910afc30b89f16f | creating tagSchema model and tag controller and handling errors and avoiding duplicate tag in the backend |
```
5 changes: 5 additions & 0 deletions client/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import Link from "next/link";
import {APP_NAME} from "../config.js";
import NProgress from "nprogress";
import {logout,isAuthenticated} from "../actions/authentication.js";
import Router from "next/router";
import {
Expand All @@ -18,6 +19,10 @@ import {
NavbarText
} from 'reactstrap';

Router.onRouteChangeStart = url => NProgress.start();
Router.onRouteChangeComplete = url => NProgress.done();
Router.onRouteChangeError = url => NProgress.done();

const Header = (props) => {
const [isOpen, setIsOpen] = useState(false);

Expand Down
5 changes: 5 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"isomorphic-fetch": "^3.0.0",
"js-cookie": "^2.2.1",
"next": "^10.0.5",
"nprogress": "^0.2.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"reactstrap": "^8.8.1"
Expand Down
3 changes: 3 additions & 0 deletions client/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class MyDocument extends Document {
href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css"
integrity="sha512-oc9+XSs1H243/FRN9Rw62Fn8EtxjEYWHXRvjS43YtueEewbS6ObfXcJNyohjHqVKFPoXXUxwc+q1K7Dee6vv9g=="
crossOrigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css"
integrity="sha512-42kB9yDlYiCEfx2xVwq0q7hT4uf26FUgSIZBK8uiaEnTdShXjwr8Ip1V4xGJMg3mHkUt9nNuTDxunHF0/EgxLQ=="
crossorigin="anonymous" />
</Head>
<body>
<Main />
Expand Down

0 comments on commit 4d78c7a

Please sign in to comment.