From 4ad152f5251cfe16876b6e6966cc2a0d396fad6a Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 23 Jan 2025 10:30:49 +0800 Subject: [PATCH] chore: change some --- .../app/create-app-dialog/newAppDialog.tsx | 20 ++++++---- web/app/components/base/dialog/index.tsx | 39 ++++++++++++++----- web/app/components/base/drawer/index.tsx | 14 +++---- .../new-feature-panel/dialog-wrapper.tsx | 19 +++++---- .../base/fullscreen-modal/index.tsx | 34 ++++++++++++---- 5 files changed, 89 insertions(+), 37 deletions(-) diff --git a/web/app/components/app/create-app-dialog/newAppDialog.tsx b/web/app/components/app/create-app-dialog/newAppDialog.tsx index 21459773a6..33e7d779f5 100644 --- a/web/app/components/app/create-app-dialog/newAppDialog.tsx +++ b/web/app/components/app/create-app-dialog/newAppDialog.tsx @@ -1,6 +1,6 @@ import { Fragment, useCallback } from 'react' import type { ReactNode } from 'react' -import { Dialog, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, Transition } from '@headlessui/react' import cn from '@/utils/classnames' type DialogProps = { @@ -20,7 +20,7 @@ const NewAppDialog = ({ return ( -
- + */} + {/* TODO: to new Transition */} +
- - + {children} - - + + */} + {/* TODO: to new Transition */} + + {children} +
diff --git a/web/app/components/base/dialog/index.tsx b/web/app/components/base/dialog/index.tsx index f43906777b..6554ef9009 100644 --- a/web/app/components/base/dialog/index.tsx +++ b/web/app/components/base/dialog/index.tsx @@ -1,6 +1,6 @@ import { Fragment, useCallback } from 'react' import type { ElementType, ReactNode } from 'react' -import { Dialog, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, DialogTitle, Transition } from '@headlessui/react' import classNames from '@/utils/classnames' // https://headlessui.com/react/dialog @@ -34,7 +34,7 @@ const CustomDialog = ({ return ( -
- + */} + {/* TODO: to new Transition */} +
- - + {Boolean(title) && ( - {title} - + )}
{children} @@ -74,8 +76,27 @@ const CustomDialog = ({ {footer}
)} -
-
+ + */} + {/* TODO: to new Transition */} + + {Boolean(title) && ( + + {title} + + )} +
+ {children} +
+ {Boolean(footer) && ( +
+ {footer} +
+ )} +
diff --git a/web/app/components/base/drawer/index.tsx b/web/app/components/base/drawer/index.tsx index c1057b9f1f..8cd4b19d0a 100644 --- a/web/app/components/base/drawer/index.tsx +++ b/web/app/components/base/drawer/index.tsx @@ -1,5 +1,5 @@ 'use client' -import { Dialog } from '@headlessui/react' +import { Dialog, DialogPanel, DialogTitle } from '@headlessui/react' import { useTranslation } from 'react-i18next' import { XMarkIcon } from '@heroicons/react/24/outline' import Button from '../button' @@ -48,21 +48,21 @@ export default function Drawer({ >
{/* mask */} -
<> - {title && {title} - } - {showClose && + } + {showClose && - } - {description && {description}} + } + {description &&
{description}
} {children} {footer || (footer === null diff --git a/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx b/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx index e2b03faad2..37e6871099 100644 --- a/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx +++ b/web/app/components/base/features/new-feature-panel/dialog-wrapper.tsx @@ -1,6 +1,6 @@ import { Fragment, useCallback } from 'react' import type { ReactNode } from 'react' -import { Dialog, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, Transition } from '@headlessui/react' import cn from '@/utils/classnames' type DialogProps = { @@ -22,7 +22,7 @@ const DialogWrapper = ({ return ( -
- + */} +
- - + {children} - - + + */} + {/* TODO: to new Transition */} + + {children} +
diff --git a/web/app/components/base/fullscreen-modal/index.tsx b/web/app/components/base/fullscreen-modal/index.tsx index 752a91cecc..9a76dfa62b 100644 --- a/web/app/components/base/fullscreen-modal/index.tsx +++ b/web/app/components/base/fullscreen-modal/index.tsx @@ -1,4 +1,4 @@ -import { Dialog, Transition } from '@headlessui/react' +import { Dialog, DialogPanel, Transition } from '@headlessui/react' import { Fragment } from 'react' import { RiCloseLargeLine } from '@remixicon/react' import classNames from '@/utils/classnames' @@ -27,7 +27,7 @@ export default function FullScreenModal({ return ( -
- + */} + {/* TODO: to new Transition */} +
- -
} {children} - - + + */} + {/* TODO: to new Transition */} + + {closable + &&
{ + e.stopPropagation() + onClose() + }}> + +
} + {children} +