From ead34c07ee42ed1136e42160bc4821b7a0f8a623 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Wed, 28 Jan 2026 12:02:42 +0000 Subject: [PATCH] fix(BOOK-711): Added isFloating prop to decide when the booking widget should have a border radius Approved-by: Bianca Widstam --- .../FormContent/formContent.module.css | 25 +++++++++++-------- .../BookingWidgetForm/FormContent/index.tsx | 6 +++-- .../BookingWidget/BookingWidgetForm/index.tsx | 8 +++++- .../lib/components/BookingWidget/Client.tsx | 16 +++++++++--- .../FloatingBookingWidgetClient.tsx | 6 ++++- .../MobileToggleButton/button.module.css | 5 +++- .../MobileToggleButton/index.tsx | 5 +++- .../BookingWidget/bookingWidget.module.css | 23 ++++++----------- .../lib/components/BookingWidget/variant.ts | 25 +++++++++++-------- 9 files changed, 74 insertions(+), 45 deletions(-) diff --git a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/formContent.module.css b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/formContent.module.css index b12b4cc6e..1e6f427e2 100644 --- a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/formContent.module.css +++ b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/formContent.module.css @@ -1,3 +1,8 @@ +.formContent { + display: flex; + flex-direction: column; +} + .vouchersHeader { display: flex; gap: var(--Space-x15); @@ -100,25 +105,25 @@ height: fit-content; } -.input { - display: flex; - flex-direction: column; +@media screen and (min-width: 768px) and (max-width: 1366px) { + .formContent.floating .voucherContainer { + border-bottom-left-radius: var(--Corner-Radius-lg); + border-bottom-right-radius: var(--Corner-Radius-lg); + } } @media screen and (min-width: 768px) { - .input { + .formContent { display: flex; align-items: center; flex-direction: row; } + .inputContainer { display: flex; flex: 2; gap: var(--Space-x15); } - .voucherContainer { - border-radius: 0 0 var(--Corner-Radius-md) var(--Corner-Radius-md); - } .rooms, .when, @@ -154,7 +159,7 @@ } @media screen and (min-width: 768px) and (max-width: 1366px) { - .input { + .formContent { flex-wrap: wrap; } .inputRow { @@ -197,8 +202,8 @@ .inputContainer { margin-left: calc(-1 * var(--Space-x15)); } - .input { - gap: var(--Space-x15); + .formContent { + gap: var(--Space-x2); } .inputRow { flex: 1; diff --git a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/index.tsx b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/index.tsx index 77bc1e696..612582a3e 100644 --- a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/index.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/index.tsx @@ -31,11 +31,13 @@ type BookingWidgetFormContentProps = { formId: string onSubmit: () => void isSearching: boolean + isFloating: boolean } export default function FormContent({ formId, onSubmit, isSearching, + isFloating, }: BookingWidgetFormContentProps) { const intl = useIntl() const { @@ -61,7 +63,7 @@ export default function FormContent({ const nights = dt(selectedDate.toDate).diff(dt(selectedDate.fromDate), "days") return ( -
+
@@ -170,7 +172,7 @@ export function BookingWidgetFormContentSkeleton() { const intl = useIntl() return ( -
+
diff --git a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/index.tsx b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/index.tsx index 12952f6b0..d4abde052 100644 --- a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/index.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/index.tsx @@ -32,9 +32,14 @@ const formId = "booking-widget" type BookingWidgetFormProps = { type?: BookingWidgetType + isFloating: boolean onClose: () => void } -export default function Form({ type, onClose }: BookingWidgetFormProps) { +export default function Form({ + type, + isFloating, + onClose, +}: BookingWidgetFormProps) { const router = useRouter() const pathname = usePathname() const lang = useLang() @@ -106,6 +111,7 @@ export default function Form({ type, onClose }: BookingWidgetFormProps) { formId={formId} onSubmit={handleSubmit(onSubmit)} isSearching={isPending} + isFloating={isFloating} /> diff --git a/packages/booking-flow/lib/components/BookingWidget/Client.tsx b/packages/booking-flow/lib/components/BookingWidget/Client.tsx index b6d4e3552..7752e589e 100644 --- a/packages/booking-flow/lib/components/BookingWidget/Client.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/Client.tsx @@ -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 | 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({
- +
-
+
diff --git a/packages/booking-flow/lib/components/BookingWidget/FloatingBookingWidget/FloatingBookingWidgetClient.tsx b/packages/booking-flow/lib/components/BookingWidget/FloatingBookingWidget/FloatingBookingWidgetClient.tsx index 30e51dfd5..3e8b06af8 100644 --- a/packages/booking-flow/lib/components/BookingWidget/FloatingBookingWidget/FloatingBookingWidgetClient.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/FloatingBookingWidget/FloatingBookingWidgetClient.tsx @@ -56,7 +56,11 @@ export function FloatingBookingWidgetClient(props: Props) { ref={containerRef} >
- +
) diff --git a/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/button.module.css b/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/button.module.css index e6bf170cc..6c9c92b76 100644 --- a/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/button.module.css +++ b/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/button.module.css @@ -14,7 +14,10 @@ /* To avoid this "flash" the styling is set to transparent) */ /* It is a non-standard css proprty, so shouldn't have too much of an effect on accessibility. */ -webkit-tap-highlight-color: transparent; - border-radius: var(--Corner-Radius-md); + + &.floating { + border-radius: var(--Corner-Radius-md); + } } .complete { diff --git a/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/index.tsx b/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/index.tsx index 03c3a3aa7..ac59bb58b 100644 --- a/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/index.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/MobileToggleButton/index.tsx @@ -20,9 +20,11 @@ import type { BookingWidgetSchema } from "../Client" type BookingWidgetToggleButtonProps = { openMobileSearch: () => void + isFloating: boolean } export default function MobileToggleButton({ openMobileSearch, + isFloating, }: BookingWidgetToggleButtonProps) { const intl = useIntl() const lang = useLang() @@ -99,7 +101,8 @@ export default function MobileToggleButton({