diff --git a/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx b/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx index 5da7d1461..0076fa926 100644 --- a/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx +++ b/src/frontend/src/components/addNewVariableButtonComponent/addNewVariableButton.tsx @@ -70,7 +70,12 @@ export default function AddNewVariableButton({ children }): JSX.Element { }); } return ( - + - - - + ); } diff --git a/src/frontend/src/modals/baseModal/index.tsx b/src/frontend/src/modals/baseModal/index.tsx index 19fc80711..b0a3c36bb 100644 --- a/src/frontend/src/modals/baseModal/index.tsx +++ b/src/frontend/src/modals/baseModal/index.tsx @@ -15,6 +15,7 @@ import { DialogContent as ModalContent, } from "../../components/ui/dialog-with-no-close"; +import { Button } from "../../components/ui/button"; import { modalHeaderType } from "../../types/components"; import { cn } from "../../utils/utils"; @@ -61,8 +62,23 @@ const Header: React.FC<{ children: ReactNode; description: string | null }> = ({ ); }; -const Footer: React.FC<{ children: ReactNode }> = ({ children }) => { - return <>{children}; +const Footer: React.FC<{ + children?: ReactNode; + submit?: { label: string; icon?: ReactNode }; +}> = ({ children, submit }) => { + return submit ? ( +
+ {children ??
} +
+ +
+
+ ) : ( + <>{children && children} + ); }; interface BaseModalProps { children: [ @@ -91,6 +107,7 @@ interface BaseModalProps { disable?: boolean; onChangeOpenModal?: (open?: boolean) => void; type?: "modal" | "dialog"; + onSubmit?: () => void; } function BaseModal({ open, @@ -99,6 +116,7 @@ function BaseModal({ size = "large", onChangeOpenModal, type = "dialog", + onSubmit, }: BaseModalProps) { const headerChild = React.Children.toArray(children).find( (child) => (child as React.ReactElement).type === Header, @@ -212,13 +230,34 @@ function BaseModal({
{headerChild}
-
- {ContentChild} -
- {ContentFooter && ( -
{ContentFooter}
+ {onSubmit ? ( +
{ + event.preventDefault(); + onSubmit(); + }} + className="flex flex-col gap-4" + > +
+ {ContentChild} +
+ {ContentFooter && ( +
{ContentFooter}
+ )} +
+ ) : ( + <> +
+ {ContentChild} +
+ {ContentFooter && ( +
{ContentFooter}
+ )} + )}