File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
src/client/src/pages/Admin/Components Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ import {
3
+ Box ,
4
+ Backdrop ,
5
+ CircularProgress ,
6
+ Typography ,
7
+ } from "@material-ui/core" ;
8
+
9
+ export default function Loading ( { text, speed = 300 } ) {
10
+ const [ content , setContent ] = React . useState ( text ) ;
11
+
12
+ React . useEffect ( ( ) => {
13
+ const id = window . setInterval ( ( ) => {
14
+ setContent ( ( content ) => {
15
+ return content === `${ text } ...` ? text : `${ content } .` ;
16
+ } ) ;
17
+ } , speed ) ;
18
+
19
+ return ( ) => window . clearInterval ( id ) ;
20
+ } , [ text , speed ] ) ;
21
+
22
+ return (
23
+ < Backdrop open = { true } >
24
+ < Box
25
+ display = "flex"
26
+ flexDirection = "column"
27
+ justifyContent = "center"
28
+ alignItems = "center"
29
+ >
30
+ < CircularProgress size = { 60 } />
31
+ { text &&
32
+ < Box paddingTop = "16px" >
33
+ < Typography >
34
+ { content }
35
+ </ Typography >
36
+ </ Box >
37
+ }
38
+ </ Box >
39
+ </ Backdrop >
40
+ ) ;
41
+ }
You can’t perform that action at this time.
0 commit comments