ConceptPortal-public/rsconcept/frontend/src/components/ui/SubmitButton.tsx
IRBorisov 867e60581b
Some checks are pending
Frontend CI / build (18.x) (push) Waiting to run
Improve cursor blocking icon
2024-06-18 15:19:19 +03:00

34 lines
795 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.

import clsx from 'clsx';
import { CProps } from '../props';
interface SubmitButtonProps extends CProps.Button {
text?: string;
loading?: boolean;
icon?: React.ReactNode;
}
function SubmitButton({ text = 'ОК', icon, disabled, loading, className, ...restProps }: SubmitButtonProps) {
return (
<button
type='submit'
className={clsx(
'px-3 py-1 flex gap-2 items-center justify-center',
'border',
'font-medium',
'clr-btn-primary',
'select-none disabled:cursor-auto',
loading && 'cursor-progress',
className
)}
disabled={disabled ?? loading}
{...restProps}
>
{icon ? <span>{icon}</span> : null}
{text ? <span>{text}</span> : null}
</button>
);
}
export default SubmitButton;