|
| 1 | +import { Dialog, Transition } from "@headlessui/react"; |
| 2 | +import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; |
| 3 | +import { Fragment } from "react"; |
| 4 | + |
| 5 | +interface Props { |
| 6 | + openState: boolean; |
| 7 | + handleClose: () => void; |
| 8 | +} |
| 9 | + |
| 10 | +export const Modal = ({ openState, handleClose }: Props) => { |
| 11 | + return ( |
| 12 | + <Transition.Root show={openState} as={Fragment}> |
| 13 | + <Dialog as="div" className="relative z-10" onClose={handleClose}> |
| 14 | + <Transition.Child |
| 15 | + as={Fragment} |
| 16 | + enter="ease-out duration-300" |
| 17 | + enterFrom="opacity-0" |
| 18 | + enterTo="opacity-100" |
| 19 | + leave="ease-in duration-200" |
| 20 | + leaveFrom="opacity-100" |
| 21 | + leaveTo="opacity-0" |
| 22 | + > |
| 23 | + <div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" /> |
| 24 | + </Transition.Child> |
| 25 | + |
| 26 | + <div className="fixed inset-0 z-10 overflow-y-auto"> |
| 27 | + <div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> |
| 28 | + <Transition.Child |
| 29 | + as={Fragment} |
| 30 | + enter="ease-out duration-300" |
| 31 | + enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" |
| 32 | + enterTo="opacity-100 translate-y-0 sm:scale-100" |
| 33 | + leave="ease-in duration-200" |
| 34 | + leaveFrom="opacity-100 translate-y-0 sm:scale-100" |
| 35 | + leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" |
| 36 | + > |
| 37 | + <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm sm:p-6"> |
| 38 | + <div> |
| 39 | + <div className="absolute top-0 right-0 pt-4 pr-4"> |
| 40 | + <button |
| 41 | + type="button" |
| 42 | + className="rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" |
| 43 | + onClick={handleClose} |
| 44 | + > |
| 45 | + <span className="sr-only">Close</span> |
| 46 | + <XMarkIcon className="h-6 w-6" aria-hidden="true" /> |
| 47 | + </button> |
| 48 | + </div> |
| 49 | + <div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100"> |
| 50 | + <CheckIcon |
| 51 | + className="h-6 w-6 text-green-600" |
| 52 | + aria-hidden="true" |
| 53 | + /> |
| 54 | + </div> |
| 55 | + <div className="mt-3 text-center sm:mt-5"> |
| 56 | + <Dialog.Title |
| 57 | + as="h3" |
| 58 | + className="text-lg font-medium leading-6 text-gray-900" |
| 59 | + > |
| 60 | + Debug Mode |
| 61 | + </Dialog.Title> |
| 62 | + <div className="mt-2"> |
| 63 | + <p className="text-sm text-gray-500"> |
| 64 | + Lorem ipsum dolor sit amet consectetur adipisicing elit. |
| 65 | + Consequatur amet labore. |
| 66 | + </p> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | + </div> |
| 70 | + </Dialog.Panel> |
| 71 | + </Transition.Child> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + </Dialog> |
| 75 | + </Transition.Root> |
| 76 | + ); |
| 77 | +}; |
0 commit comments