Merged in fix/SW-2427-floating-booking-widget-fullwidth (pull request #1826)
fix: when floating booking widget is sticky let it have white background all the way out. SW-2427 * fix: when floating booking widget is sticky let it have white background all the way out. Resolves SW-2427 * pr: move styling variants to it's own file Approved-by: Christian Andolf
This commit is contained in:
@@ -6,4 +6,4 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@netlify/functions": "^3.0.0"
|
"@netlify/functions": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod"
|
import { zodResolver } from "@hookform/resolvers/zod"
|
||||||
import { cva } from "class-variance-authority"
|
|
||||||
import { use, useEffect, useRef, useState } from "react"
|
import { use, useEffect, useRef, useState } from "react"
|
||||||
import { FormProvider, useForm } from "react-hook-form"
|
import { FormProvider, useForm } from "react-hook-form"
|
||||||
|
|
||||||
@@ -25,6 +24,10 @@ import { convertSearchParamsToObj } from "@/utils/url"
|
|||||||
import MobileToggleButton, {
|
import MobileToggleButton, {
|
||||||
MobileToggleButtonSkeleton,
|
MobileToggleButtonSkeleton,
|
||||||
} from "./MobileToggleButton"
|
} from "./MobileToggleButton"
|
||||||
|
import {
|
||||||
|
bookingWidgetContainerVariants,
|
||||||
|
formContainerVariants,
|
||||||
|
} from "./variant"
|
||||||
|
|
||||||
import styles from "./bookingWidget.module.css"
|
import styles from "./bookingWidget.module.css"
|
||||||
|
|
||||||
@@ -198,11 +201,15 @@ export default function BookingWidgetClient({
|
|||||||
type,
|
type,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const formContainerClassNames = formContainerVariants({
|
||||||
|
type,
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormProvider {...methods}>
|
<FormProvider {...methods}>
|
||||||
<section ref={bookingWidgetRef} className={classNames} data-open={isOpen}>
|
<section ref={bookingWidgetRef} className={classNames} data-open={isOpen}>
|
||||||
<MobileToggleButton openMobileSearch={openMobileSearch} />
|
<MobileToggleButton openMobileSearch={openMobileSearch} />
|
||||||
<div className={styles.formContainer}>
|
<div className={formContainerClassNames}>
|
||||||
<button
|
<button
|
||||||
className={styles.close}
|
className={styles.close}
|
||||||
onClick={closeMobileSearch}
|
onClick={closeMobileSearch}
|
||||||
@@ -238,16 +245,3 @@ export function BookingWidgetSkeleton({
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const bookingWidgetContainerVariants = cva(styles.wrapper, {
|
|
||||||
variants: {
|
|
||||||
type: {
|
|
||||||
default: "",
|
|
||||||
full: "",
|
|
||||||
compact: styles.compact,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
defaultVariants: {
|
|
||||||
type: "full",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -11,18 +11,18 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
background: rgba(255, 255, 255, 0);
|
background: rgba(255, 255, 255, 0);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transition: background 0.2s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-intersecting="true"] {
|
&[data-intersecting="true"] {
|
||||||
.floatingBackground {
|
.floatingBackground {
|
||||||
background: transparent;
|
background: var(--Surface-UI-Fill-Default);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
margin-top: var(--sitewide-alert-sticky-height);
|
margin-top: var(--sitewide-alert-sticky-height);
|
||||||
|
box-shadow: 0px 4px 24px 0px rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,10 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
position: static;
|
position: static;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
&.compactFormContainer {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
|
|||||||
29
apps/scandic-web/components/BookingWidget/variant.ts
Normal file
29
apps/scandic-web/components/BookingWidget/variant.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { cva } from "class-variance-authority"
|
||||||
|
|
||||||
|
import styles from "./bookingWidget.module.css"
|
||||||
|
|
||||||
|
export const bookingWidgetContainerVariants = cva(styles.wrapper, {
|
||||||
|
variants: {
|
||||||
|
type: {
|
||||||
|
default: "",
|
||||||
|
full: "",
|
||||||
|
compact: styles.compact,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
type: "full",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export const formContainerVariants = cva(styles.formContainer, {
|
||||||
|
variants: {
|
||||||
|
type: {
|
||||||
|
default: "",
|
||||||
|
full: "",
|
||||||
|
compact: styles.compactFormContainer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
type: "full",
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import { useTransition } from "react"
|
import { useTransition } from "react"
|
||||||
import { Form as FormRAC } from "react-aria-components"
|
import { Form as FormRAC } from "react-aria-components"
|
||||||
|
|||||||
Reference in New Issue
Block a user