feat: refactor PopupModal to use Headless UI components and update FormLogin layout

This commit is contained in:
Ardeman
2025-02-22 15:17:46 +08:00
parent 531871d349
commit 54faf57262
4 changed files with 154 additions and 27 deletions
+12 -12
View File
@@ -1,3 +1,4 @@
import { Dialog, DialogBackdrop, DialogPanel } from '@headlessui/react'
import type { ReactNode } from 'react'
interface ModalProperties {
@@ -13,18 +14,17 @@ 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}
</div>
<Dialog
open={isOpen}
onClose={onClose}
className="relative z-50"
>
<DialogBackdrop className="fixed inset-0 bg-black/30" />
<div className="fixed inset-0 flex w-screen items-center justify-center p-4">
<DialogPanel className="max-w-lg space-y-4 rounded-lg bg-white p-8 shadow-lg">
<div className="relative">{children}</div>
</DialogPanel>
</div>
</>
</Dialog>
)
}