Fix/disable cancel button on save (#6204)

# This PR

- Fix #5675 
- Fix #6118 

Similarly to #5673 I have improved the field creation time by
re-fetching data on page redirection to the object page

<img width="1511" alt="Screenshot 2024-07-10 at 16 06 37"
src="https://github.com/twentyhq/twenty/assets/61581306/8ef8f4cb-4334-4f4c-b5d9-fea11fd5d99a">

@FellipeMTX @Bonapara

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
Pacifique LINJANJA
2024-07-11 07:56:07 +02:00
committed by GitHub
parent 6bc36635eb
commit 9917fb0f9e
6 changed files with 39 additions and 30 deletions

View File

@ -2,8 +2,19 @@ import { LightButton } from '@/ui/input/button/components/LightButton';
type CancelButtonProps = {
onCancel?: () => void;
disabled?: boolean;
};
export const CancelButton = ({ onCancel }: CancelButtonProps) => {
return <LightButton title="Cancel" accent="tertiary" onClick={onCancel} />;
export const CancelButton = ({
onCancel,
disabled = false,
}: CancelButtonProps) => {
return (
<LightButton
title="Cancel"
accent="tertiary"
onClick={onCancel}
disabled={disabled}
/>
);
};

View File

@ -13,16 +13,18 @@ type SaveAndCancelButtonsProps = {
onSave?: () => void;
onCancel?: () => void;
isSaveDisabled?: boolean;
isCancelDisabled?: boolean;
};
export const SaveAndCancelButtons = ({
onSave,
onCancel,
isSaveDisabled,
isCancelDisabled,
}: SaveAndCancelButtonsProps) => {
return (
<StyledContainer>
<CancelButton onCancel={onCancel} />
<CancelButton onCancel={onCancel} disabled={isCancelDisabled} />
<SaveButton onSave={onSave} disabled={isSaveDisabled} />
</StyledContainer>
);