ConceptPortal-public/rsconcept/frontend/src/components/Common/SubmitButton.tsx
2023-07-25 22:29:33 +03:00

21 lines
599 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

interface SubmitButtonProps {
text: string
loading?: boolean
disabled?: boolean
icon?: React.ReactNode
}
function SubmitButton({ text = 'ОК', icon, disabled, loading = false }: SubmitButtonProps) {
return (
<button type='submit'
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' : ''}`}
disabled={disabled ?? loading}
>
{icon && <span>{icon}</span>}
{text && <span>{text}</span>}
</button>
)
}
export default SubmitButton;