mirror of
https://github.com/hexastack/hexabot
synced 2025-02-22 20:38:32 +00:00
fix(frontend): update dialog close button
This commit is contained in:
parent
89f0811116
commit
7ef81e7999
@ -6,7 +6,6 @@
|
||||
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
||||
*/
|
||||
|
||||
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import {
|
||||
IconButton,
|
||||
@ -23,31 +22,16 @@ const StyledDialogTitle = styled(Typography)(() => ({
|
||||
export const DialogTitle = ({
|
||||
children,
|
||||
onClose,
|
||||
onCloseV2,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
onClose?: () => void;
|
||||
onCloseV2?:
|
||||
| ((event: {}, reason: "backdropClick" | "escapeKeyDown") => void)
|
||||
| undefined;
|
||||
}) => (
|
||||
<MuiDialogTitle>
|
||||
<StyledDialogTitle>{children}</StyledDialogTitle>
|
||||
{onClose && (
|
||||
<IconButton
|
||||
size="small"
|
||||
aria-label="close"
|
||||
onClick={(e) => {
|
||||
if (onCloseV2) {
|
||||
onCloseV2(e, "backdropClick");
|
||||
} else {
|
||||
//TODO: the old onClose prop can be replaced by the new one after the full implementation of the useDialogs hook
|
||||
onClose();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{onClose ? (
|
||||
<IconButton size="small" aria-label="close" onClick={onClose}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
) : null}
|
||||
</MuiDialogTitle>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user