import { useMemo } from 'react'; import { primary } from 'styles/colors'; const sizeMap = { large: 80, } as const; const spinnerProps = { 1: { viewBox: '0 0 50 50', from: '0 25 25', to: '360 25 25', d: 'M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z', }, 2: { viewBox: '0 0 32 32', from: '0 16 16', to: '360 16 16', d: 'M5.60882 28.1665C3.36504 26.2501 1.69492 23.7506 0.783081 20.9443L4.58731 19.7082C5.27118 21.813 6.52378 23.6876 8.20661 25.1249C9.88944 26.5621 11.937 27.5061 14.1228 27.8523C16.3086 28.1985 18.5476 27.9335 20.5922 27.0865C22.6368 26.2396 24.4074 24.8438 25.7082 23.0534C27.009 21.263 27.7894 19.1477 27.963 16.9415C28.1366 14.7353 27.6968 12.524 26.6921 10.5521C25.6874 8.58025 24.1569 6.92464 22.27 5.76831C20.383 4.61199 18.2131 3.99999 16 3.99999L16 -8.29455e-06C18.9507 -8.42353e-06 21.844 0.815984 24.36 2.35775C26.8759 3.89952 28.9165 6.107 30.2561 8.73614C31.5957 11.3653 32.1822 14.3137 31.9507 17.2553C31.7191 20.197 30.6787 23.0173 28.9443 25.4046C27.2098 27.7918 24.8491 29.6529 22.1229 30.7821C19.3968 31.9113 16.4115 32.2646 13.497 31.803C10.5826 31.3414 7.85259 30.0829 5.60882 28.1665Z', }, }; interface Props { /** Size of the spinner, in number (in `px`) or `large` */ size?: string | number; /** Color of the spinner */ color?: string; /** Model of the spinner */ model?: number; } /** * Spinner component is used to indicate a loading state. */ const Spinner = ({ size = 16, color = primary.main, model = 1 }: Props) => { const { viewBox, d, from, to } = useMemo(() => spinnerProps[model], [model]); return ( ); }; export default Spinner;