feat: adj component

This commit is contained in:
fredy.siswanto
2025-02-22 15:15:04 +07:00
parent 84e49cd335
commit ac13e2a854
18 changed files with 464 additions and 219 deletions
+17 -12
View File
@@ -1,6 +1,7 @@
import { Dialog, DialogPanel } from '@headlessui/react'
import type { ReactNode } from 'react'
interface ModalProperties {
type ModalProperties = {
isOpen: boolean
onClose: () => void
children: ReactNode
@@ -13,18 +14,22 @@ export default function PopupModal({
}: ModalProperties) {
if (!isOpen) return
return (
<>
<div className="bg-opacity-50 fixed inset-0 z-50 grid place-items-center bg-gray-300/50">
<button
onClick={onClose}
className="absolute top-5 right-5 z-50 bg-red-500 p-3 text-gray-500 hover:text-gray-800"
>
✖
</button>
<div className="relative rounded-lg bg-white p-6 shadow-lg">
{children}
<Dialog
open={isOpen}
as="div"
className="relative z-30 focus:outline-none"
onClose={onClose}
>
<div className="fixed inset-0 z-30 w-screen overflow-y-auto backdrop-blur-sm">
<div className="flex min-h-full items-center justify-center sm:p-4">
<DialogPanel
transition
className="w-full rounded-xl bg-white p-5 shadow duration-300 ease-out data-[closed]:transform-[scale(95%)] data-[closed]:opacity-0 max-md:min-h-screen max-md:min-w-screen max-sm:p-[50px] sm:max-w-md sm:p-10"
>
{children}
</DialogPanel>
</div>
</div>
</>
</Dialog>
)
}