From fef2326d6e69e340591b97e43fa0bf2f71ef6fe6 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 6 Feb 2025 17:30:46 +0800 Subject: [PATCH] fix: transation new --- .../app/create-app-dialog/newAppDialog.tsx | 63 ------------- .../base/fullscreen-modal/index.tsx | 92 ++++++++----------- 2 files changed, 36 insertions(+), 119 deletions(-) delete mode 100644 web/app/components/app/create-app-dialog/newAppDialog.tsx diff --git a/web/app/components/app/create-app-dialog/newAppDialog.tsx b/web/app/components/app/create-app-dialog/newAppDialog.tsx deleted file mode 100644 index 33e7d779f5..0000000000 --- a/web/app/components/app/create-app-dialog/newAppDialog.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Fragment, useCallback } from 'react' -import type { ReactNode } from 'react' -import { Dialog, DialogPanel, Transition } from '@headlessui/react' -import cn from '@/utils/classnames' - -type DialogProps = { - className?: string - children: ReactNode - show: boolean - onClose?: () => void -} - -const NewAppDialog = ({ - className, - children, - show, - onClose, -}: DialogProps) => { - const close = useCallback(() => onClose?.(), [onClose]) - return ( - - - {/* -
- */} - {/* TODO: to new Transition */} -
- -
-
- {/* - - {children} - - */} - {/* TODO: to new Transition */} - - {children} - -
-
-
-
- ) -} - -export default NewAppDialog diff --git a/web/app/components/base/fullscreen-modal/index.tsx b/web/app/components/base/fullscreen-modal/index.tsx index 9a76dfa62b..f53ebc5b29 100644 --- a/web/app/components/base/fullscreen-modal/index.tsx +++ b/web/app/components/base/fullscreen-modal/index.tsx @@ -1,7 +1,7 @@ import { Dialog, DialogPanel, Transition } from '@headlessui/react' -import { Fragment } from 'react' import { RiCloseLargeLine } from '@remixicon/react' import classNames from '@/utils/classnames' +import { useEffect, useState } from 'react' type IModal = { className?: string @@ -24,62 +24,42 @@ export default function FullScreenModal({ closable = false, overflowVisible = false, }: IModal) { + const [showTransition, setShowTransition] = useState(false) + useEffect(() => { + if (!open) { + setShowTransition(false) + return + } + setTimeout(() => { + setShowTransition(true) + }, 100) + }, [open]) return ( - - - {/* -
- */} - {/* TODO: to new Transition */} -
+ + +
+ -
{ - e.preventDefault() - e.stopPropagation() - }} - > -
- {/* - - {closable - &&
{ - e.stopPropagation() - onClose() - }}> - -
} - {children} -
-
*/} - {/* TODO: to new Transition */} +
{ + e.preventDefault() + e.stopPropagation() + }} + > +
+ {closable @@ -94,9 +74,9 @@ export default function FullScreenModal({
} {children} -
+
-
- +
+
) }