Browse Source

fix dailog closing even on static backdrop option

Abhinav 3 years ago
parent
commit
b7ff942c4a
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/components/DialogBox/index.tsx

+ 8 - 5
src/components/DialogBox/index.tsx

@@ -25,6 +25,9 @@ type IProps = React.PropsWithChildren<
 export default function DialogBox({
 export default function DialogBox({
     attributes,
     attributes,
     children,
     children,
+    open,
+    size,
+    onClose,
     titleCloseButton,
     titleCloseButton,
     ...props
     ...props
 }: IProps) {
 }: IProps) {
@@ -35,13 +38,13 @@ export default function DialogBox({
     const handleClose = dialogCloseHandler({
     const handleClose = dialogCloseHandler({
         staticBackdrop: attributes.staticBackdrop,
         staticBackdrop: attributes.staticBackdrop,
         nonClosable: attributes.nonClosable,
         nonClosable: attributes.nonClosable,
-        onClose: props.onClose,
+        onClose: onClose,
     });
     });
 
 
     return (
     return (
         <DialogBoxBase
         <DialogBoxBase
-            open={props.open}
-            maxWidth={props.size}
+            open={open}
+            maxWidth={size}
             onClose={handleClose}
             onClose={handleClose}
             {...props}>
             {...props}>
             {attributes.title && (
             {attributes.title && (
@@ -66,7 +69,7 @@ export default function DialogBox({
                                 onClick={() => {
                                 onClick={() => {
                                     attributes.close.action &&
                                     attributes.close.action &&
                                         attributes.close?.action();
                                         attributes.close?.action();
-                                    props.onClose();
+                                    onClose();
                                 }}>
                                 }}>
                                 {attributes.close?.text ?? constants.OK}
                                 {attributes.close?.text ?? constants.OK}
                             </Button>
                             </Button>
@@ -76,7 +79,7 @@ export default function DialogBox({
                                 color={attributes.proceed?.variant}
                                 color={attributes.proceed?.variant}
                                 onClick={() => {
                                 onClick={() => {
                                     attributes.proceed.action();
                                     attributes.proceed.action();
-                                    props.onClose();
+                                    onClose();
                                 }}
                                 }}
                                 disabled={attributes.proceed.disabled}>
                                 disabled={attributes.proceed.disabled}>
                                 {attributes.proceed.text}
                                 {attributes.proceed.text}