fix(BOOK-711): Added isFloating prop to decide when the booking widget should have a border radius
Approved-by: Bianca Widstam
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { cx } from "class-variance-authority"
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import { use, useEffect, useRef, useState } from "react"
|
||||
import { FormProvider, useForm } from "react-hook-form"
|
||||
@@ -43,6 +44,7 @@ export type BookingWidgetClientProps = {
|
||||
type?: BookingWidgetType
|
||||
data: BookingWidgetSearchData
|
||||
pageSettingsBookingCodePromise: Promise<string> | null
|
||||
isFloating?: boolean
|
||||
}
|
||||
export const FOCUS_WIDGET = "focusWidget"
|
||||
|
||||
@@ -50,6 +52,7 @@ export default function BookingWidgetClient({
|
||||
type,
|
||||
data,
|
||||
pageSettingsBookingCodePromise,
|
||||
isFloating = false,
|
||||
}: BookingWidgetClientProps) {
|
||||
const searchParams = useSearchParams()
|
||||
const focusWidget = searchParams.get(FOCUS_WIDGET) === "true"
|
||||
@@ -245,10 +248,13 @@ export default function BookingWidgetClient({
|
||||
<FormProvider {...methods}>
|
||||
<section
|
||||
ref={bookingWidgetRef}
|
||||
className={classNames}
|
||||
className={cx(classNames, { [styles.floating]: isFloating })}
|
||||
data-booking-widget-open={isOpen}
|
||||
>
|
||||
<MobileToggleButton openMobileSearch={openMobileSearch} />
|
||||
<MobileToggleButton
|
||||
openMobileSearch={openMobileSearch}
|
||||
isFloating={isFloating}
|
||||
/>
|
||||
<div className={styles.backdrop} onClick={closeMobileSearch} />
|
||||
<div className={formContainerClassNames}>
|
||||
<button
|
||||
@@ -258,7 +264,11 @@ export default function BookingWidgetClient({
|
||||
>
|
||||
<MaterialIcon icon="close" />
|
||||
</button>
|
||||
<Form type={type} onClose={closeMobileSearch} />
|
||||
<Form
|
||||
type={type}
|
||||
onClose={closeMobileSearch}
|
||||
isFloating={isFloating}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</FormProvider>
|
||||
|
||||
Reference in New Issue
Block a user