import { Button, ButtonProps, CircularProgress } from '@mui/material'
import React from 'react'

interface ActionButtonProps extends ButtonProps {
  loading?: boolean
}

export default function ActionButton({ loading, ...props }: ActionButtonProps) {
  return (
    <Button
      sx={{ height: '50px' }}
      variant={!props?.variant ? 'contained' : props?.variant}
      endIcon={loading ? <CircularProgress size={20} /> : null}
      disabled={loading}
      {...props}
    >
      {props.children}
    </Button>
  )
}
