From f786f6fa07268c33b0a4538eb93a118c648182dc Mon Sep 17 00:00:00 2001 From: Pontus Dreij Date: Fri, 15 Nov 2024 11:02:17 +0100 Subject: [PATCH] fix(SW-350): Close booking widget on search (mobile) --- components/BookingWidget/Client.tsx | 2 +- components/Forms/BookingWidget/index.tsx | 8 ++++++-- types/components/form/bookingwidget.ts | 8 ++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/BookingWidget/Client.tsx b/components/BookingWidget/Client.tsx index 930cad4c0..0c7ef1b88 100644 --- a/components/BookingWidget/Client.tsx +++ b/components/BookingWidget/Client.tsx @@ -173,7 +173,7 @@ export default function BookingWidgetClient({ > -
+
diff --git a/components/Forms/BookingWidget/index.tsx b/components/Forms/BookingWidget/index.tsx index 6c78ea341..243fceaa5 100644 --- a/components/Forms/BookingWidget/index.tsx +++ b/components/Forms/BookingWidget/index.tsx @@ -17,7 +17,11 @@ import { Location } from "@/types/trpc/routers/hotel/locations" const formId = "booking-widget" -export default function Form({ locations, type }: BookingWidgetFormProps) { +export default function Form({ + locations, + type, + setIsOpen, +}: BookingWidgetFormProps) { const router = useRouter() const lang = useLang() @@ -52,7 +56,7 @@ export default function Form({ locations, type }: BookingWidgetFormProps) { ) }) }) - + setIsOpen(false) router.push(`${bookingFlowPage}?${bookingWidgetParams.toString()}`) } diff --git a/types/components/form/bookingwidget.ts b/types/components/form/bookingwidget.ts index 14a548952..887c4eae2 100644 --- a/types/components/form/bookingwidget.ts +++ b/types/components/form/bookingwidget.ts @@ -1,14 +1,10 @@ -import { FormState, UseFormReturn } from "react-hook-form" - -import type { - BookingWidgetSchema, - BookingWidgetType, -} from "@/types/components/bookingWidget" +import type { BookingWidgetType } from "@/types/components/bookingWidget" import type { Location, Locations } from "@/types/trpc/routers/hotel/locations" export interface BookingWidgetFormProps { locations: Locations type?: BookingWidgetType + setIsOpen: (isOpen: boolean) => void } export interface BookingWidgetFormContentProps {