Skip to content

Commit

Permalink
Cancel not mandatory in forms
Browse files Browse the repository at this point in the history
  • Loading branch information
anagperal committed Jun 27, 2024
1 parent 07b4192 commit 8fe5ab0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/webapp/components/form-page/FormPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type FormPageProps = {
cancelLabel?: string;
children: React.ReactNode;
onSave: () => void;
onCancel: () => void;
onCancel?: () => void;
};

export const FormPage: React.FC<FormPageProps> = React.memo(
Expand All @@ -31,9 +31,11 @@ export const FormPage: React.FC<FormPageProps> = React.memo(
<Separator margin="12px" />
<ButtonsFooter>
<Button onClick={onSave}>{saveLabel || i18n.t("Save")}</Button>
<Button onClick={onCancel} variant="outlined" color="secondary">
{cancelLabel || i18n.t("Cancel")}
</Button>
{onCancel && (
<Button onClick={onCancel} variant="outlined" color="secondary">
{cancelLabel || i18n.t("Cancel")}
</Button>
)}
</ButtonsFooter>
</Footer>
</StyledFormPage>
Expand Down

0 comments on commit 8fe5ab0

Please sign in to comment.