feat : add footer , header , base css, progressBar , main and page components
This commit is contained in:
28
src/common/ProgressBar.tsx
Normal file
28
src/common/ProgressBar.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useLocation, useNavigationType } from "react-router-dom";
|
||||
import NProgress from "nprogress";
|
||||
import "nprogress/nprogress.css";
|
||||
|
||||
const ProgressBar = () => {
|
||||
const location = useLocation();
|
||||
const navigationType = useNavigationType();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (navigationType === "PUSH") {
|
||||
setLoading(true);
|
||||
NProgress.start();
|
||||
}
|
||||
}, [location, navigationType]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loading) {
|
||||
NProgress.done();
|
||||
setLoading(false);
|
||||
}
|
||||
}, [loading, location]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export default ProgressBar;
|
||||
Reference in New Issue
Block a user