fix(SW-1043): added hook with the scroll logic

This commit is contained in:
Tobias Johansson
2024-12-02 10:32:56 +01:00
parent 92db90502c
commit c354fbe434
2 changed files with 53 additions and 12 deletions

View File

@@ -42,16 +42,6 @@ export function extractGuestFromUser(user: NonNullable<SafeUser>) {
export function navigate(step: StepEnum, searchParams: string) {
window.history.pushState({ step }, "", `${step}?${searchParams}`)
const element = document.querySelector(`[data-step='${step}']`)
const isMobile = window.matchMedia("(max-width: 768px)").matches
if (element && isMobile) {
element.addEventListener(
"transitionend",
() => element?.scrollIntoView({ behavior: "smooth" }),
{ once: true }
)
}
}
export function checkIsSameBooking(prev: BookingData, next: BookingData) {