import MuiLoadingButton from '@mui/lab/LoadingButton';
import CircularProgress from '@mui/material/CircularProgress';

import type { LoadingButtonProps } from '@mui/lab/LoadingButton';

const LoadingButton = (props: LoadingButtonProps) => {
	return (
		<MuiLoadingButton
			{...{
				loadingIndicator: (
					<CircularProgress
						color={
							props?.variant === 'primary'
								? 'secondary'
								: 'primary'
						}
						size={24}
					/>
				),
				...props,
			}}
		/>
	);
};

LoadingButton.defaultProps = {
	fullWidth: true,
	variant: 'primary',
	size: 'large',
};

export default LoadingButton;
