Skip to content

Commit

Permalink
fix: ensure className prop is properly handled
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-anderson committed Feb 20, 2024
1 parent 874cb90 commit ac1b39c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/Form/FormControlButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { styled } from "@mui/material/styles";
import Box, { type BoxProps } from "@mui/material/Box";
import { FormSubmitButton, type FormSubmitButtonProps } from "@components/Form/FormSubmitButton";
import { BackButton, type BackButtonProps } from "@components/Navigation/BackButton";
import { BackButton, type BackButtonProps } from "@/components/Navigation/BackButton";
import { FormSubmitButton, type FormSubmitButtonProps } from "./FormSubmitButton";
import { formClassNames } from "./classNames";

/**
* A `Form` component which includes `<FormSubmitButton />` and `<BackButton />` components
* for convenience. The buttons are contained within a flex-box.
*/
export const FormControlButtons = ({
FormSubmitButtonProps = {},
BackButtonProps = {},
...containerProps
className = "",
...boxProps
}: FormControlButtonsProps) => (
<StyledBox className={formClassNames.controlButtonsContainer} {...containerProps}>
<StyledBox className={formClassNames.controlButtonsContainer + " " + className} {...boxProps}>
<FormSubmitButton {...FormSubmitButtonProps} />
<BackButton label="Cancel" {...BackButtonProps} />
</StyledBox>
Expand All @@ -36,12 +41,11 @@ const StyledBox = styled(Box)(({ theme }) => ({
: { width: "min-content", margin: "0" }),
paddingLeft: "1.5rem",
paddingRight: "1.5rem",
lineHeight: "2rem",
borderRadius: "1.5rem",
},
}));

export type FormControlButtonsProps = {
FormSubmitButtonProps?: FormSubmitButtonProps;
BackButtonProps?: BackButtonProps;
} & BoxProps;
} & Omit<BoxProps, "children">;

0 comments on commit ac1b39c

Please sign in to comment.