mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +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).
|
* 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 CloseIcon from "@mui/icons-material/Close";
|
||||||
import {
|
import {
|
||||||
IconButton,
|
IconButton,
|
||||||
@ -23,31 +22,16 @@ const StyledDialogTitle = styled(Typography)(() => ({
|
|||||||
export const DialogTitle = ({
|
export const DialogTitle = ({
|
||||||
children,
|
children,
|
||||||
onClose,
|
onClose,
|
||||||
onCloseV2,
|
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
onCloseV2?:
|
|
||||||
| ((event: {}, reason: "backdropClick" | "escapeKeyDown") => void)
|
|
||||||
| undefined;
|
|
||||||
}) => (
|
}) => (
|
||||||
<MuiDialogTitle>
|
<MuiDialogTitle>
|
||||||
<StyledDialogTitle>{children}</StyledDialogTitle>
|
<StyledDialogTitle>{children}</StyledDialogTitle>
|
||||||
{onClose && (
|
{onClose ? (
|
||||||
<IconButton
|
<IconButton size="small" aria-label="close" onClick={onClose}>
|
||||||
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();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
) : null}
|
||||||
</MuiDialogTitle>
|
</MuiDialogTitle>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user