parent
8e64a9a185
commit
9a5d825a0a
1 changed files with 31 additions and 20 deletions
@ -1,28 +1,39 @@ |
||||
import { styled } from '@mui/material/styles'; |
||||
import { CircularProgress } from '@mui/material'; |
||||
import { FC } from 'react'; |
||||
import { |
||||
Box as MUIBox, |
||||
BoxProps as MUIBoxProps, |
||||
CircularProgress as MUICircularProgress, |
||||
circularProgressClasses as muiCircularProgressClasses, |
||||
} from '@mui/material'; |
||||
|
||||
import { TEXT } from '../lib/consts/DEFAULT_THEME'; |
||||
|
||||
const PREFIX = 'Spinner'; |
||||
type SpinnerProps = MUIBoxProps; |
||||
|
||||
const classes = { |
||||
spinner: `${PREFIX}-spinner`, |
||||
}; |
||||
const Spinner: FC<SpinnerProps> = (spinnerProps): JSX.Element => { |
||||
const { sx, ...spinnerRestProps } = spinnerProps; |
||||
|
||||
const StyledDiv = styled('div')(() => ({ |
||||
display: 'flex', |
||||
alignItems: 'center', |
||||
justifyContent: 'center', |
||||
marginTop: '3em', |
||||
return ( |
||||
<MUIBox |
||||
{...{ |
||||
...spinnerRestProps, |
||||
sx: { |
||||
alignItems: 'center', |
||||
display: 'flex', |
||||
justifyContent: 'center', |
||||
marginTop: '3em', |
||||
|
||||
[`& .${classes.spinner}`]: { |
||||
color: TEXT, |
||||
}, |
||||
})); |
||||
[`& .${muiCircularProgressClasses.root}`]: { |
||||
color: TEXT, |
||||
}, |
||||
|
||||
const Spinner = (): JSX.Element => ( |
||||
<StyledDiv> |
||||
<CircularProgress variant="indeterminate" className={classes.spinner} /> |
||||
</StyledDiv> |
||||
); |
||||
...sx, |
||||
}, |
||||
}} |
||||
> |
||||
<MUICircularProgress variant="indeterminate" /> |
||||
</MUIBox> |
||||
); |
||||
}; |
||||
|
||||
export default Spinner; |
||||
|
Loading…
Reference in new issue