From 0b412cf7ad2890738deb4b44da2d9ca81b6f50a5 Mon Sep 17 00:00:00 2001 From: Jing Hua Date: Sat, 4 Mar 2023 20:17:26 +0800 Subject: [PATCH] feat: popup modal --- src/components/PopupModal/PopupModal.tsx | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/components/PopupModal/PopupModal.tsx diff --git a/src/components/PopupModal/PopupModal.tsx b/src/components/PopupModal/PopupModal.tsx new file mode 100644 index 0000000..8a17efa --- /dev/null +++ b/src/components/PopupModal/PopupModal.tsx @@ -0,0 +1,74 @@ +import React from 'react'; + +import CrossIcon2 from '@icon/CrossIcon2'; + +const PopupModal = ({ + title = 'Information', + message, + setIsModalOpen, + handleConfirm, + handleClose, + children, +}: { + title?: string; + message?: string; + setIsModalOpen: React.Dispatch>; + handleConfirm: () => void; + handleClose?: () => void; + children?: React.ReactElement; +}) => { + const _handleClose = () => { + handleClose && handleClose(); + setIsModalOpen(false); + }; + + return ( +
+
+
+
+

+ {title} +

+ +
+ + {message && ( +
+
+ {message} +
+
+ )} + + {children} + +
+ + +
+
+
+
+ ); +}; + +export default PopupModal;