fix(striker-ui): expose progress component props in Spinner

main
Tsu-ba-me 2 years ago
parent b576e799e2
commit 7182961a45
  1. 24
      striker-ui/components/Spinner.tsx

@ -4,19 +4,33 @@ import {
BoxProps as MUIBoxProps, BoxProps as MUIBoxProps,
CircularProgress as MUICircularProgress, CircularProgress as MUICircularProgress,
circularProgressClasses as muiCircularProgressClasses, circularProgressClasses as muiCircularProgressClasses,
CircularProgressProps as MUICircularProgressProps,
} from '@mui/material'; } from '@mui/material';
import { TEXT } from '../lib/consts/DEFAULT_THEME'; import { TEXT } from '../lib/consts/DEFAULT_THEME';
type SpinnerProps = MUIBoxProps; type SpinnerOptionalProps = {
progressProps?: MUICircularProgressProps;
};
type SpinnerProps = MUIBoxProps & SpinnerOptionalProps;
const SPINNER_DEFAULT_PROPS: Required<SpinnerOptionalProps> = {
progressProps: {},
};
const Spinner: FC<SpinnerProps> = (spinnerProps): JSX.Element => { const Spinner: FC<SpinnerProps> = (spinnerProps): JSX.Element => {
const { sx, ...spinnerRestProps } = spinnerProps; const {
sx,
progressProps = SPINNER_DEFAULT_PROPS.progressProps,
...spinnerRestProps
} = spinnerProps;
return ( return (
<MUIBox <MUIBox
{...{ {...{
...spinnerRestProps, ...spinnerRestProps,
sx: { sx: {
alignItems: 'center', alignItems: 'center',
display: 'flex', display: 'flex',
@ -31,9 +45,13 @@ const Spinner: FC<SpinnerProps> = (spinnerProps): JSX.Element => {
}, },
}} }}
> >
<MUICircularProgress variant="indeterminate" /> <MUICircularProgress
{...{ ...progressProps, variant: 'indeterminate' }}
/>
</MUIBox> </MUIBox>
); );
}; };
Spinner.defaultProps = SPINNER_DEFAULT_PROPS;
export default Spinner; export default Spinner;

Loading…
Cancel
Save