import { createPortal } from 'react-dom' import styles from './style.module.scss' import { PropsWithChildren } from 'react' interface Props { desc?: string variant?: 'small' | 'default' } export const LoadingSpinner = (props: PropsWithChildren) => { const { desc, children, variant = 'default' } = props switch (variant) { case 'small': return (
) default: return createPortal(
{desc && (
{desc} {children}
)}
, document.getElementById('root')! ) } }