wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import type { ReactNode } from 'react'
import { Transition, TransitionChild } from '@headlessui/react'
import classNames from '@/utils/classnames'
 
type ContentDialogProps = {
  className?: string
  show: boolean
  onClose?: () => void
  children: ReactNode
}
 
const ContentDialog = ({
  className,
  show,
  onClose,
  children,
}: ContentDialogProps) => {
  return (
    <Transition
      show={show}
      as="div"
      className="absolute left-0 top-0 z-20 box-border h-full w-full p-2"
    >
      <TransitionChild>
        <div
          className={classNames(
            'absolute left-0 inset-0 w-full bg-app-detail-overlay-bg',
            'duration-300 ease-in data-[closed]:opacity-0',
            'data-[enter]:opacity-100',
            'data-[leave]:opacity-0',
          )}
          onClick={onClose}
        />
      </TransitionChild>
 
      <TransitionChild>
        <div className={classNames(
          'absolute left-0 w-full bg-app-detail-bg border-r border-divider-burn',
          'duration-100 ease-in data-[closed]:-translate-x-full',
          'data-[enter]:ease-out data-[enter]:duration-300 data-[enter]:translate-x-0',
          'data-[leave]:ease-in data-[leave]:duration-200 data-[leave]:-translate-x-full',
          className,
        )}>
          {children}
        </div>
      </TransitionChild>
    </Transition>
  )
}
 
export default ContentDialog