import { Fade } from '@mui/material'; import { Box } from '@mui/material'; import useDefaultProps from '../../hooks/useDefaultProps'; export interface SpinProps { spinning?: boolean; indicator?: React.ReactNode; children: React.ReactNode; } const Spin = (inProps: SpinProps) => { const { spinning = true, indicator = ( div': { backgroundColor: 'primary.main', margin: '4px', width: 8, height: 8, borderRadius: '100%', display: 'inline-block', WebkitAnimation: 'spin-bouncedelay 1s infinite ease-in-out both', animation: 'spin-bouncedelay 1s infinite ease-in-out both', '&.spin-bounce1': { WebkitAnimationDelay: '-0.32s', animationDelay: '-0.32s' }, '&.spin-bounce2': { WebkitAnimationDelay: '-0.16s', animationDelay: '-0.16s' } } }} > ), children } = useDefaultProps({ name: 'ReevolveSpin', props: inProps }); return ( {indicator} ({ position: 'relative', transition: `all 250ms ${theme.transitions.easing.easeInOut}`, opacity: spinning ? 0.3 : 1, userSelect: spinning ? 'none' : undefined, pointerEvents: spinning ? 'none' : 'auto', '&::after': { position: 'absolute', inset: 0, zIndex: 10, height: '100%', opacity: spinning ? 0.3 : 0, visibility: spinning ? 'visible' : 'hidden', transition: `all 250ms ${theme.transitions.easing.easeInOut}`, content: '""', pointerEvents: spinning ? 'none' : 'auto' } })} > {children} ); }; declare module '@mui/material' { interface Components { ReevolveSpin?: { defaultProps?: Partial; }; } } export default Spin;