mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
(nextjs) added SSR Loader
This commit is contained in:
parent
d7def635e3
commit
41b26e7d69
5 changed files with 79 additions and 1 deletions
22
src/components/common/LoadingProgress/index.tsx
Normal file
22
src/components/common/LoadingProgress/index.tsx
Normal file
|
@ -0,0 +1,22 @@
|
|||
import React, { Fragment, VFC } from 'react';
|
||||
|
||||
import { useSSRLoadingIndicator } from '~/hooks/dom/useSSRLoadingIndicator';
|
||||
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
interface LoadingProgressProps {}
|
||||
|
||||
const LoadingProgress: VFC<LoadingProgressProps> = () => {
|
||||
const shown = useSSRLoadingIndicator();
|
||||
|
||||
return shown ? (
|
||||
<>
|
||||
<div className={styles.loader} />
|
||||
<div className={styles.label}>Секундочку...</div>
|
||||
</>
|
||||
) : (
|
||||
<Fragment />
|
||||
);
|
||||
};
|
||||
|
||||
export { LoadingProgress };
|
38
src/components/common/LoadingProgress/styles.module.scss
Normal file
38
src/components/common/LoadingProgress/styles.module.scss
Normal file
|
@ -0,0 +1,38 @@
|
|||
@import "src/styles/variables";
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: 100vw 0;
|
||||
}
|
||||
}
|
||||
|
||||
.loader {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
z-index: 100;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(90deg, $dark_blue, $soft_blue, $dark_blue);
|
||||
animation: spin infinite 1s linear;
|
||||
}
|
||||
|
||||
.label {
|
||||
position: fixed;
|
||||
top: $gap + 4px;
|
||||
left: 50%;
|
||||
font: $font_12_semibold;
|
||||
background: red;
|
||||
z-index: 100;
|
||||
transform: translate(-50%, 0);
|
||||
padding: 2px 10px;
|
||||
border-radius: 10px;
|
||||
background: $cyan_gradient;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue