Browse Source

avoid close dialog when clicking outside

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 year ago
parent
commit
a366d7f24e

+ 5 - 1
client/src/components/customDialog/CustomDialog.tsx

@@ -98,7 +98,11 @@ const CustomDialog: FC<CustomDialogType> = props => {
         container: `${containerClass}`,
         container: `${containerClass}`,
       }}
       }}
       open={open}
       open={open}
-      onClose={handleCancel}
+      onClose={(event, reason) => {
+        if (reason !== 'backdropClick') {
+          handleCancel();
+        }
+      }}
     >
     >
       {type === 'notice' ? (
       {type === 'notice' ? (
         <form onSubmit={handleConfirm}>
         <form onSubmit={handleConfirm}>

+ 2 - 7
client/src/components/customDialog/CustomDialogTitle.tsx

@@ -1,9 +1,4 @@
-import {
-  DialogTitleProps,
-  makeStyles,
-  Theme,
-  Typography,
-} from '@material-ui/core';
+import { DialogTitleProps, makeStyles, Typography } from '@material-ui/core';
 import MuiDialogTitle from '@material-ui/core/DialogTitle';
 import MuiDialogTitle from '@material-ui/core/DialogTitle';
 import icons from '../icons/Icons';
 import icons from '../icons/Icons';
 import { theme } from '../../styles/theme';
 import { theme } from '../../styles/theme';
@@ -18,7 +13,7 @@ const getStyles = makeStyles(() => ({
   title: {
   title: {
     fontWeight: 500,
     fontWeight: 500,
     wordBreak: 'break-all',
     wordBreak: 'break-all',
-    maxWidth: 500
+    maxWidth: 500,
   },
   },
   icon: {
   icon: {
     fontSize: '24px',
     fontSize: '24px',