-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dashboard header top add
nprogress
Loading
- Loading branch information
Showing
7 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 17 additions & 3 deletions
20
packages/leaa-dashboard/src/components/Spinner/Spinner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
import React from 'react'; | ||
import { Spin } from 'antd'; | ||
import _ from 'lodash'; | ||
// @ts-ignore | ||
import NProgress from 'nprogress'; | ||
// import { Spin } from 'antd'; | ||
|
||
import style from './style.module.less'; | ||
export const Spinner = () => { | ||
React.useEffect(() => { | ||
const nStart = _.debounce(NProgress.start, 100); | ||
nStart(); | ||
|
||
export const Spinner = () => <Spin className={style['suspense-fallback-loader']} />; | ||
return () => { | ||
nStart.cancel(); | ||
NProgress.done(); | ||
}; | ||
}, []); | ||
|
||
return null; | ||
// return <Spin className={style['suspense-fallback-loader']} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@import './variables.less'; | ||
@import './nprogress.less'; | ||
|
||
body { | ||
&:after { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@import './variables.less'; | ||
|
||
/* Make clicks pass-through */ | ||
#nprogress { | ||
pointer-events: none; | ||
} | ||
|
||
#nprogress .bar { | ||
background: @primary-color; | ||
position: fixed; | ||
z-index: 10001; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 2px; | ||
opacity: 0.9; | ||
} | ||
|
||
/* Fancy blur effect */ | ||
#nprogress .peg { | ||
display: block; | ||
position: absolute; | ||
right: 0; | ||
width: 100px; | ||
height: 100%; | ||
box-shadow: 0 0 10px @primary-color, 0 0 15px @primary-color; | ||
opacity: 1; | ||
transform: rotate(3deg) translate(0, -4px); | ||
} | ||
|
||
#nprogress .spinner { | ||
display: none; | ||
//display: block; | ||
position: fixed; | ||
z-index: 10001; | ||
top: 3px; | ||
right: 3px; | ||
} | ||
|
||
#nprogress .spinner-icon { | ||
@w: 17px; | ||
|
||
width: @w; | ||
height: @w; | ||
box-sizing: border-box; | ||
border: solid 2px transparent; | ||
border-top-color: @primary-color; | ||
border-left-color: @primary-color; | ||
border-radius: 50%; | ||
animation: nprogress-spinner 600ms linear infinite; | ||
} | ||
|
||
.nprogress-custom-parent { | ||
overflow: hidden; | ||
position: relative; | ||
} | ||
|
||
.nprogress-custom-parent #nprogress .spinner, | ||
.nprogress-custom-parent #nprogress .bar { | ||
position: absolute; | ||
} | ||
|
||
@keyframes nprogress-spinner { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
|
||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters