2023-07-15 17:46:19 +03:00
|
|
|
|
interface SubmitButtonProps {
|
|
|
|
|
text: string
|
2023-07-16 20:25:55 +03:00
|
|
|
|
loading?: boolean
|
2023-07-15 17:46:19 +03:00
|
|
|
|
disabled?: boolean
|
2023-07-22 03:18:48 +03:00
|
|
|
|
icon?: React.ReactNode
|
2023-07-15 17:46:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-25 20:27:29 +03:00
|
|
|
|
function SubmitButton({ text = 'ОК', icon, disabled, loading = false }: SubmitButtonProps) {
|
2023-07-15 17:46:19 +03:00
|
|
|
|
return (
|
|
|
|
|
<button type='submit'
|
2023-07-25 20:27:29 +03:00
|
|
|
|
className={`px-4 py-2 inline-flex items-center gap-2 align-middle justify-center font-bold disabled:cursor-not-allowed rounded clr-btn-primary ${loading ? ' cursor-progress' : ''}`}
|
2023-07-15 17:46:19 +03:00
|
|
|
|
disabled={disabled}
|
|
|
|
|
>
|
2023-07-22 03:18:48 +03:00
|
|
|
|
{icon && <span>{icon}</span>}
|
|
|
|
|
{text && <span>{text}</span>}
|
2023-07-15 17:46:19 +03:00
|
|
|
|
</button>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-25 20:27:29 +03:00
|
|
|
|
export default SubmitButton;
|