fix(striker-ui): allow style overrides in Spinner

This commit is contained in:
Tsu-ba-me 2022-05-12 21:45:37 -04:00
parent 8e64a9a185
commit 9a5d825a0a

View File

@ -1,28 +1,39 @@
import { styled } from '@mui/material/styles'; import { FC } from 'react';
import { CircularProgress } from '@mui/material'; import {
Box as MUIBox,
BoxProps as MUIBoxProps,
CircularProgress as MUICircularProgress,
circularProgressClasses as muiCircularProgressClasses,
} from '@mui/material';
import { TEXT } from '../lib/consts/DEFAULT_THEME'; import { TEXT } from '../lib/consts/DEFAULT_THEME';
const PREFIX = 'Spinner'; type SpinnerProps = MUIBoxProps;
const classes = { const Spinner: FC<SpinnerProps> = (spinnerProps): JSX.Element => {
spinner: `${PREFIX}-spinner`, const { sx, ...spinnerRestProps } = spinnerProps;
};
const StyledDiv = styled('div')(() => ({ return (
display: 'flex', <MUIBox
{...{
...spinnerRestProps,
sx: {
alignItems: 'center', alignItems: 'center',
display: 'flex',
justifyContent: 'center', justifyContent: 'center',
marginTop: '3em', marginTop: '3em',
[`& .${classes.spinner}`]: { [`& .${muiCircularProgressClasses.root}`]: {
color: TEXT, color: TEXT,
}, },
}));
const Spinner = (): JSX.Element => ( ...sx,
<StyledDiv> },
<CircularProgress variant="indeterminate" className={classes.spinner} /> }}
</StyledDiv> >
<MUICircularProgress variant="indeterminate" />
</MUIBox>
); );
};
export default Spinner; export default Spinner;