fix(SW-350): Close booking widget on search (mobile)

This commit is contained in:
Pontus Dreij
2024-11-15 11:02:17 +01:00
parent 49fbd87bd8
commit f786f6fa07
3 changed files with 9 additions and 9 deletions

View File

@@ -173,7 +173,7 @@ export default function BookingWidgetClient({
> >
<CloseLargeIcon /> <CloseLargeIcon />
</button> </button>
<Form locations={locations} type={type} /> <Form locations={locations} type={type} setIsOpen={setIsOpen} />
</div> </div>
</section> </section>
<div className={styles.backdrop} onClick={closeMobileSearch} /> <div className={styles.backdrop} onClick={closeMobileSearch} />

View File

@@ -17,7 +17,11 @@ import { Location } from "@/types/trpc/routers/hotel/locations"
const formId = "booking-widget" const formId = "booking-widget"
export default function Form({ locations, type }: BookingWidgetFormProps) { export default function Form({
locations,
type,
setIsOpen,
}: BookingWidgetFormProps) {
const router = useRouter() const router = useRouter()
const lang = useLang() const lang = useLang()
@@ -52,7 +56,7 @@ export default function Form({ locations, type }: BookingWidgetFormProps) {
) )
}) })
}) })
setIsOpen(false)
router.push(`${bookingFlowPage}?${bookingWidgetParams.toString()}`) router.push(`${bookingFlowPage}?${bookingWidgetParams.toString()}`)
} }

View File

@@ -1,14 +1,10 @@
import { FormState, UseFormReturn } from "react-hook-form" import type { BookingWidgetType } from "@/types/components/bookingWidget"
import type {
BookingWidgetSchema,
BookingWidgetType,
} from "@/types/components/bookingWidget"
import type { Location, Locations } from "@/types/trpc/routers/hotel/locations" import type { Location, Locations } from "@/types/trpc/routers/hotel/locations"
export interface BookingWidgetFormProps { export interface BookingWidgetFormProps {
locations: Locations locations: Locations
type?: BookingWidgetType type?: BookingWidgetType
setIsOpen: (isOpen: boolean) => void
} }
export interface BookingWidgetFormContentProps { export interface BookingWidgetFormContentProps {