|
|
|
|
@ -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 (
|
|
|
|
|
<Transition appear show={show} as={Fragment}>
|
|
|
|
|
<Dialog as="div" className="relative z-40" onClose={close}>
|
|
|
|
|
<Transition.Child
|
|
|
|
|
{/* <Transition.Child
|
|
|
|
|
as={Fragment}
|
|
|
|
|
enter="ease-out duration-300"
|
|
|
|
|
enterFrom="opacity-0"
|
|
|
|
|
@ -44,11 +44,13 @@ const CustomDialog = ({
|
|
|
|
|
leaveTo="opacity-0"
|
|
|
|
|
>
|
|
|
|
|
<div className="fixed inset-0 bg-black bg-opacity-25" />
|
|
|
|
|
</Transition.Child>
|
|
|
|
|
</Transition.Child> */}
|
|
|
|
|
{/* TODO: to new Transition */}
|
|
|
|
|
<div className="fixed inset-0 bg-black bg-opacity-25" />
|
|
|
|
|
|
|
|
|
|
<div className="fixed inset-0 overflow-y-auto">
|
|
|
|
|
<div className="flex items-center justify-center min-h-full">
|
|
|
|
|
<Transition.Child
|
|
|
|
|
{/* <Transition.Child
|
|
|
|
|
as={Fragment}
|
|
|
|
|
enter="ease-out duration-300"
|
|
|
|
|
enterFrom="opacity-0 scale-95"
|
|
|
|
|
@ -57,14 +59,14 @@ const CustomDialog = ({
|
|
|
|
|
leaveFrom="opacity-100 scale-100"
|
|
|
|
|
leaveTo="opacity-0 scale-95"
|
|
|
|
|
>
|
|
|
|
|
<Dialog.Panel className={classNames('w-full max-w-[800px] p-6 overflow-hidden transition-all transform bg-components-panel-bg border-[0.5px] border-components-panel-border shadow-xl rounded-2xl', className)}>
|
|
|
|
|
<DialogPanel className={classNames('w-full max-w-[800px] p-6 overflow-hidden transition-all transform bg-components-panel-bg border-[0.5px] border-components-panel-border shadow-xl rounded-2xl', className)}>
|
|
|
|
|
{Boolean(title) && (
|
|
|
|
|
<Dialog.Title
|
|
|
|
|
<DialogTitle
|
|
|
|
|
as={titleAs || 'h3'}
|
|
|
|
|
className={classNames('pr-8 pb-3 title-2xl-semi-bold text-text-primary', titleClassName)}
|
|
|
|
|
>
|
|
|
|
|
{title}
|
|
|
|
|
</Dialog.Title>
|
|
|
|
|
</DialogTitle>
|
|
|
|
|
)}
|
|
|
|
|
<div className={classNames(bodyClassName)}>
|
|
|
|
|
{children}
|
|
|
|
|
@ -74,8 +76,27 @@ const CustomDialog = ({
|
|
|
|
|
{footer}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</Dialog.Panel>
|
|
|
|
|
</Transition.Child>
|
|
|
|
|
</DialogPanel>
|
|
|
|
|
</Transition.Child> */}
|
|
|
|
|
{/* TODO: to new Transition */}
|
|
|
|
|
<DialogPanel className={classNames('w-full max-w-[800px] p-6 overflow-hidden transition-all transform bg-components-panel-bg border-[0.5px] border-components-panel-border shadow-xl rounded-2xl', className)}>
|
|
|
|
|
{Boolean(title) && (
|
|
|
|
|
<DialogTitle
|
|
|
|
|
as={titleAs || 'h3'}
|
|
|
|
|
className={classNames('pr-8 pb-3 title-2xl-semi-bold text-text-primary', titleClassName)}
|
|
|
|
|
>
|
|
|
|
|
{title}
|
|
|
|
|
</DialogTitle>
|
|
|
|
|
)}
|
|
|
|
|
<div className={classNames(bodyClassName)}>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
{Boolean(footer) && (
|
|
|
|
|
<div className={classNames('flex items-center justify-end gap-2 px-6 pb-6 pt-3', footerClassName)}>
|
|
|
|
|
{footer}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</DialogPanel>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Dialog>
|
|
|
|
|
|