feat(SW-350): Update design for booking widget

This commit is contained in:
Pontus Dreij
2024-10-02 15:36:58 +02:00
parent e8027be2e8
commit d58c77493a
19 changed files with 162 additions and 33 deletions

View File

@@ -22,6 +22,7 @@ import type { Location } from "@/types/trpc/routers/hotel/locations"
export default function BookingWidgetClient({
locations,
type,
}: BookingWidgetClientProps) {
const [isOpen, setIsOpen] = useState(false)
@@ -99,8 +100,9 @@ export default function BookingWidgetClient({
>
<CloseLarge />
</button>
<Form locations={locations} />
<Form locations={locations} type={type} />
</section>
<div className={styles.backdrop} onClick={closeMobileSearch} />
<MobileToggleButton openMobileSearch={openMobileSearch} />
</FormProvider>
)

View File

@@ -6,6 +6,10 @@
display: grid;
gap: var(--Spacing-x-one-and-half);
padding: var(--Spacing-x2);
position: sticky;
top: 0;
z-index: 1;
background-color: var(--Base-Surface-Primary-light-Normal);
}
.complete {
@@ -13,7 +17,7 @@
}
.partial {
grid-template-columns: min(1fr, 150px) min-content min(1fr, 150px) 1fr;
grid-template-columns: minmax(auto, 150px) min-content minmax(auto, 150px) auto;
}
.icon {
@@ -27,7 +31,7 @@
width: 36px;
}
@media screen and (min-width: 768px) {
@media screen and (min-width: 767px) {
.complete,
.partial {
display: none;

View File

@@ -1,16 +1,17 @@
@media screen and (max-width: 1366px) {
@media screen and (max-width: 766px) {
.container {
background-color: var(--UI-Input-Controls-Surface-Normal);
bottom: -100%;
display: grid;
gap: var(--Spacing-x3);
grid-template-rows: 36px 1fr;
height: 100dvh;
height: calc(100dvh - 20px);
padding: var(--Spacing-x3) var(--Spacing-x2) var(--Spacing-x7);
position: fixed;
transition: bottom 300ms ease;
width: 100%;
z-index: 10000;
border-radius: var(--Corner-radius-Large) var(--Corner-radius-Large) 0 0;
}
.container[data-open="true"] {
@@ -23,13 +24,26 @@
cursor: pointer;
justify-self: flex-end;
}
.container[data-open="true"] + .backdrop {
background-color: rgba(0, 0, 0, 0.4);
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 1000;
}
}
@media screen and (min-width: 1367px) {
@media screen and (min-width: 767px) {
.container {
border-bottom: 1px solid var(--Base-Border-Subtle);
border-top: 1px solid var(--Base-Border-Subtle);
display: block;
box-shadow: 0px 4px 24px 0px rgba(0, 0, 0, 0.05);
position: sticky;
top: 0;
z-index: 1;
background-color: var(--Base-Surface-Primary-light-Normal);
}
.close {

View File

@@ -2,16 +2,22 @@ import { getLocations } from "@/lib/trpc/memoizedRequests"
import BookingWidgetClient from "./Client"
import type { BookingWidgetType } from "@/types/components/bookingWidget"
export function preload() {
void getLocations()
}
export default async function BookingWidget() {
export default async function BookingWidget({
type,
}: {
type: BookingWidgetType
}) {
const locations = await getLocations()
if (!locations || "error" in locations) {
return null
}
return <BookingWidgetClient locations={locations.data} />
return <BookingWidgetClient locations={locations.data} type={type} />
}