style(SW-593): adjustments to z-index
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useCallback, useEffect, useRef, useState } from "react"
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import useHotelPageStore from "@/stores/hotel-page"
|
import useHotelPageStore from "@/stores/hotel-page"
|
||||||
@@ -14,35 +12,8 @@ export default function MobileMapToggle() {
|
|||||||
const { isDynamicMapOpen, openDynamicMap, closeDynamicMap } =
|
const { isDynamicMapOpen, openDynamicMap, closeDynamicMap } =
|
||||||
useHotelPageStore()
|
useHotelPageStore()
|
||||||
|
|
||||||
const mapToggleRef = useRef<HTMLDivElement>(null)
|
|
||||||
const [isVisible, setIsVisible] = useState<boolean>(true)
|
|
||||||
|
|
||||||
const handleScroll = useCallback(() => {
|
|
||||||
if (mapToggleRef.current) {
|
|
||||||
const rect = mapToggleRef.current.getBoundingClientRect()
|
|
||||||
if (rect.top >= 150) {
|
|
||||||
setIsVisible(true)
|
|
||||||
} else {
|
|
||||||
setIsVisible(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
handleScroll()
|
|
||||||
|
|
||||||
window.addEventListener("scroll", handleScroll)
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
window.removeEventListener("scroll", handleScroll)
|
|
||||||
}
|
|
||||||
}, [handleScroll])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={mapToggleRef} className={styles.wrapper}>
|
<div className={styles.mobileToggle}>
|
||||||
<div
|
|
||||||
className={`${styles.mobileToggle} ${isVisible ? "" : styles.hidden}`}
|
|
||||||
>
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`${styles.button} ${!isDynamicMapOpen ? styles.active : ""}`}
|
className={`${styles.button} ${!isDynamicMapOpen ? styles.active : ""}`}
|
||||||
@@ -68,6 +39,5 @@ export default function MobileMapToggle() {
|
|||||||
<span>{intl.formatMessage({ id: "Map" })}</span>
|
<span>{intl.formatMessage({ id: "Map" })}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
.wrapper {
|
|
||||||
margin: 0 auto;
|
|
||||||
position: sticky;
|
|
||||||
bottom: var(--Spacing-x5);
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobileToggle {
|
.mobileToggle {
|
||||||
|
position: sticky;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
gap: var(--Spacing-x-half);
|
gap: var(--Spacing-x-half);
|
||||||
@@ -14,6 +8,9 @@
|
|||||||
background-color: var(--Base-Surface-Primary-light-Normal);
|
background-color: var(--Base-Surface-Primary-light-Normal);
|
||||||
box-shadow: 0 0 30px 2px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 0 30px 2px rgba(0, 0, 0, 0.15);
|
||||||
padding: var(--Spacing-x-half);
|
padding: var(--Spacing-x-half);
|
||||||
|
margin: 0 auto;
|
||||||
|
bottom: var(--Spacing-x5);
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
@@ -43,12 +40,8 @@
|
|||||||
background-color: var(--Primary-Strong-Surface-Hover);
|
background-color: var(--Primary-Strong-Surface-Hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 1367px) {
|
@media screen and (min-width: 1367px) {
|
||||||
.wrapper {
|
.mobileToggle {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.stickyWrapper {
|
.stickyWrapper {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: var(--booking-widget-mobile-height);
|
top: var(--booking-widget-mobile-height);
|
||||||
z-index: 1;
|
z-index: 2;
|
||||||
background-color: var(--Base-Surface-Subtle-Normal);
|
background-color: var(--Base-Surface-Subtle-Normal);
|
||||||
border-bottom: 1px solid var(--Base-Border-Subtle);
|
border-bottom: 1px solid var(--Base-Border-Subtle);
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"mapContainer";
|
"mapContainer";
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: var(--max-width);
|
max-width: var(--max-width);
|
||||||
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hotelImages {
|
.hotelImages {
|
||||||
|
|||||||
Reference in New Issue
Block a user