From ffe0ef6dc532f5bf0226e074f95a351b36c5abbd Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 21 Sep 2023 17:45:06 +0800 Subject: ... --- FrontEnd/src/components/dialog/Dialog.tsx | 60 ++++++++++++++++--------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'FrontEnd/src/components/dialog/Dialog.tsx') diff --git a/FrontEnd/src/components/dialog/Dialog.tsx b/FrontEnd/src/components/dialog/Dialog.tsx index 15c898f1..2d0b34db 100644 --- a/FrontEnd/src/components/dialog/Dialog.tsx +++ b/FrontEnd/src/components/dialog/Dialog.tsx @@ -4,6 +4,8 @@ import { CSSTransition } from "react-transition-group"; import { ThemeColor } from "../common"; +import InPortal from "../InPortal"; + import "./Dialog.css"; interface DialogProps { @@ -25,35 +27,37 @@ export default function Dialog({ const lastPointerDownIdRef = useRef(null); return ( - -
+
{ - lastPointerDownIdRef.current = e.pointerId; - }} - onPointerUp={(e) => { - if (lastPointerDownIdRef.current === e.pointerId) { - if (!disableCloseOnClickOnOverlay) onClose(); - } - lastPointerDownIdRef.current = null; - }} - /> -
{children}
-
-
+ ref={nodeRef} + className={classNames( + `cru-theme-${color ?? "primary"}`, + "cru-dialog-overlay", + )} + > +
{ + lastPointerDownIdRef.current = e.pointerId; + }} + onPointerUp={(e) => { + if (lastPointerDownIdRef.current === e.pointerId) { + if (!disableCloseOnClickOnOverlay) onClose(); + } + lastPointerDownIdRef.current = null; + }} + /> +
{children}
+
+ + ); } -- cgit v1.2.3