2023-06-29 06:31:17 +00:00
|
|
|
import { PropsWithChildren } from 'react';
|
|
|
|
|
|
|
|
import { LoadingButton } from '@@/buttons';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
submitLabel: string;
|
|
|
|
loadingText: string;
|
|
|
|
isLoading: boolean;
|
|
|
|
isValid: boolean;
|
2023-09-05 16:06:36 +00:00
|
|
|
'data-cy'?: string;
|
2023-06-29 06:31:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function FormActions({
|
|
|
|
submitLabel = 'Save',
|
|
|
|
loadingText = 'Saving',
|
|
|
|
isLoading,
|
|
|
|
children,
|
|
|
|
isValid,
|
2023-09-05 16:06:36 +00:00
|
|
|
'data-cy': dataCy,
|
2023-06-29 06:31:17 +00:00
|
|
|
}: PropsWithChildren<Props>) {
|
|
|
|
return (
|
|
|
|
<div className="form-group">
|
|
|
|
<div className="col-sm-12">
|
|
|
|
<LoadingButton
|
2023-07-10 11:03:58 +00:00
|
|
|
className="!ml-0"
|
2023-06-29 06:31:17 +00:00
|
|
|
loadingText={loadingText}
|
|
|
|
isLoading={isLoading}
|
|
|
|
disabled={!isValid}
|
2023-09-05 16:06:36 +00:00
|
|
|
data-cy={dataCy}
|
2023-06-29 06:31:17 +00:00
|
|
|
>
|
|
|
|
{submitLabel}
|
|
|
|
</LoadingButton>
|
|
|
|
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|