Skip to content

Commit

Permalink
Introduced props for naming the buttons in FixedButtonGroup
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Blaettlinger <bln1imb@bosch.com>
  • Loading branch information
andreas-blaettlinger committed Jun 13, 2024
1 parent 669297f commit eef11f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/apps/admin-ui/src/components/form/FixedButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ import style from "./fixed-buttons.module.css";
type FixedButtonGroupProps = ActionGroupProps & {
name: string;
save?: () => void;
saveText?: string;
reset?: () => void;
resetText?: string;
isSubmit?: boolean;
isActive?: boolean;
};

export const FixedButtonsGroup = ({
name,
save,
saveText,
reset,
resetText,
isSubmit = false,
isActive = true,
children,
Expand All @@ -31,7 +35,7 @@ export const FixedButtonsGroup = ({
onClick={() => save?.()}
type={isSubmit ? "submit" : "button"}
>
{t("save")}
{!saveText ? t("save") : saveText}
</Button>
)}
{reset && (
Expand All @@ -41,7 +45,7 @@ export const FixedButtonsGroup = ({
variant="link"
onClick={() => reset()}
>
{t("revert")}
{!resetText ? t("revert") : resetText}
</Button>
)}
{children}
Expand Down
2 changes: 2 additions & 0 deletions js/apps/admin-ui/src/user/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ export const UserForm = ({
</FormProvider>
<FixedButtonsGroup
name="user-creation"
saveText={user?.id ? t("save") : t("create")}
reset={onFormReset}
resetText={user?.id ? t("revert") : t("cancel")}
isActive
isSubmit
/>
Expand Down

0 comments on commit eef11f1

Please sign in to comment.