From 83dd4d7eaee1acc268c76e80e7c8e612a593b273 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 10 Sep 2023 17:48:18 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Added=20ModalSelectGuests=20comp?= =?UTF-8?q?onent=20=F0=9F=94=A7=20Updated=20ModalSelectGuests=20component?= =?UTF-8?q?=20=F0=9F=9A=80=20Implemented=20ModalSelectGuests=20improvement?= =?UTF-8?q?s=20=F0=9F=90=9B=20Fixed=20issues=20in=20ModalSelectGuests=20co?= =?UTF-8?q?mponent=20=F0=9F=8E=A8=20Refactored=20ModalSelectGuests=20for?= =?UTF-8?q?=20better=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ModalSelectGuests.tsx | 104 +++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/components/ModalSelectGuests.tsx diff --git a/src/components/ModalSelectGuests.tsx b/src/components/ModalSelectGuests.tsx new file mode 100644 index 0000000..42f2418 --- /dev/null +++ b/src/components/ModalSelectGuests.tsx @@ -0,0 +1,104 @@ +"use client"; + +import React, { FC, Fragment, useState } from "react"; +import { Dialog, Transition } from "@headlessui/react"; +import { XMarkIcon } from "@heroicons/react/24/solid"; +import ButtonPrimary from "@/shared/ButtonPrimary"; +import GuestsInput from "@/app/(client-components)/(HeroSearchForm2Mobile)/GuestsInput"; + +interface ModalSelectGuestsProps { + renderChildren?: (p: { openModal: () => void }) => React.ReactNode; +} + +const ModalSelectGuests: FC = ({ renderChildren }) => { + const [showModal, setShowModal] = useState(false); + + // FOR RESET ALL DATA WHEN CLICK CLEAR BUTTON + // + function closeModal() { + setShowModal(false); + } + + function openModal() { + setShowModal(true); + } + + const renderButtonOpenModal = () => { + return renderChildren ? ( + renderChildren({ openModal }) + ) : ( + + ); + }; + + return ( + <> + {renderButtonOpenModal()} + + +
+
+ + + <> +
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + { + closeModal(); + }} + > + Save + +
+ +
+
+
+
+
+
+ + ); +}; + +export default ModalSelectGuests;