mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix(frontend): add dialog hasButtons option
This commit is contained in:
parent
9b1d6c5381
commit
584eb83d68
@ -22,16 +22,20 @@ export const FormDialog = ({
|
|||||||
...rest
|
...rest
|
||||||
}: FormDialogProps) => {
|
}: FormDialogProps) => {
|
||||||
const onCancel = () => rest.onClose?.({}, "backdropClick");
|
const onCancel = () => rest.onClose?.({}, "backdropClick");
|
||||||
|
const dialogActions =
|
||||||
return (
|
rest.hasButtons === false ? null : (
|
||||||
<Dialog fullWidth {...rest}>
|
|
||||||
<DialogTitle onClose={onCancel}>{title}</DialogTitle>
|
|
||||||
<DialogContent>{children}</DialogContent>
|
|
||||||
<DialogActions style={{ padding: "0.5rem" }}>
|
<DialogActions style={{ padding: "0.5rem" }}>
|
||||||
<DialogFormButtons
|
<DialogFormButtons
|
||||||
{...{ onSubmit, onCancel, confirmButtonProps, cancelButtonProps }}
|
{...{ onSubmit, onCancel, confirmButtonProps, cancelButtonProps }}
|
||||||
/>
|
/>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog fullWidth {...rest}>
|
||||||
|
<DialogTitle onClose={onCancel}>{title}</DialogTitle>
|
||||||
|
<DialogContent>{children}</DialogContent>
|
||||||
|
{dialogActions}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -150,7 +150,8 @@ export interface DialogProviderProps {
|
|||||||
// form dialog
|
// form dialog
|
||||||
export interface FormDialogProps
|
export interface FormDialogProps
|
||||||
extends FormButtonsProps,
|
extends FormButtonsProps,
|
||||||
Omit<MuiDialogProps, "onSubmit"> {
|
Omit<MuiDialogProps, "onSubmit">,
|
||||||
|
DialogExtraOptions {
|
||||||
title?: string;
|
title?: string;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user