-
Notifications
You must be signed in to change notification settings - Fork 17
/
PageSpinner.js
48 lines (44 loc) · 1.16 KB
/
PageSpinner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
A big spinner centered in view port to display loading state
*/
import React from 'react';
import PropTypes from 'prop-types';
import { CircularProgress, Typography } from '@material-ui/core';
import useStyles from './Style';
import BackDrop from '../BackDrop/BackDrop';
const PageSpinner = props => {
const classes = useStyles();
const { textColor, loading, text, background } = props;
return (
<BackDrop background={background} show={loading}>
<div className={classes.spinnerWraper}>
<CircularProgress
className={classes.pageSpinner}
color='primary'
disableShrink
size='4rem'
/>
{text && (
<Typography
style={{ color: textColor }}
component='div'
variant='subtitle2'
>
{text}
</Typography>
)}
</div>
</BackDrop>
);
};
PageSpinner.propTypes = {
loading: PropTypes.bool.isRequired,
text: PropTypes.string,
background: PropTypes.string,
textColor: PropTypes.string
};
PageSpinner.defaultProps = {
background: 'rgba(0,0,0,0.1)',
textColor: 'rgba(0,0,0,0.87)'
};
export default PageSpinner;