diff --git a/components/ContentType/HotelPage/Facilities/CardGrid/cardGrid.module.css b/components/ContentType/HotelPage/Facilities/CardGrid/cardGrid.module.css index 7c97fb3bd..be60e0f7f 100644 --- a/components/ContentType/HotelPage/Facilities/CardGrid/cardGrid.module.css +++ b/components/ContentType/HotelPage/Facilities/CardGrid/cardGrid.module.css @@ -1,3 +1,7 @@ +.cardContainer { + scroll-margin-top: var(--hotel-page-scroll-margin-top); +} + .spanOne { grid-column: span 1; } diff --git a/components/ContentType/HotelPage/Facilities/CardGrid/index.tsx b/components/ContentType/HotelPage/Facilities/CardGrid/index.tsx index 8bb1dff40..f14270fea 100644 --- a/components/ContentType/HotelPage/Facilities/CardGrid/index.tsx +++ b/components/ContentType/HotelPage/Facilities/CardGrid/index.tsx @@ -26,7 +26,7 @@ export default function FacilitiesCardGrid({ } return ( -
+
{facilitiesCardGrid.map((card: FacilityCardType) => ( diff --git a/components/ContentType/HotelPage/Rooms/index.tsx b/components/ContentType/HotelPage/Rooms/index.tsx index b6fd241f5..62f0f448d 100644 --- a/components/ContentType/HotelPage/Rooms/index.tsx +++ b/components/ContentType/HotelPage/Rooms/index.tsx @@ -13,6 +13,7 @@ import { RoomCard } from "./RoomCard" import styles from "./rooms.module.css" +import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation" import type { RoomsProps } from "./types" export function Rooms({ rooms }: RoomsProps) { @@ -50,8 +51,11 @@ export function Rooms({ rooms }: RoomsProps) { } return ( - -
+ +
(true) - const hotelTabLinks: { href: HotelHashValues | string; text: string }[] = [ + const hotelTabLinks: { hash: HotelHashValues | string; text: string }[] = [ { - href: HotelHashValues.overview, + hash: HotelHashValues.overview, text: intl.formatMessage({ id: "Overview" }), }, - { href: HotelHashValues.rooms, text: intl.formatMessage({ id: "Rooms" }) }, + { hash: HotelHashValues.rooms, text: intl.formatMessage({ id: "Rooms" }) }, { - href: HotelHashValues.restaurant, + hash: HotelHashValues.restaurant, text: intl.formatMessage({ id: restaurantTitle }, { count: 1 }), }, { - href: HotelHashValues.meetings, + hash: HotelHashValues.meetings, text: intl.formatMessage({ id: "Meetings & Conferences" }), }, { - href: HotelHashValues.wellness, + hash: HotelHashValues.wellness, text: intl.formatMessage({ id: "Wellness & Exercise" }), }, { - href: HotelHashValues.activities, + hash: HotelHashValues.activities, text: intl.formatMessage({ id: "Activities" }), }, - { href: HotelHashValues.faq, text: intl.formatMessage({ id: "FAQ" }) }, + { hash: HotelHashValues.faq, text: intl.formatMessage({ id: "FAQ" }) }, ] + const { activeSectionId, pauseScrollSpy } = useScrollSpy( + hotelTabLinks.map(({ hash }) => hash) + ) + + useEffect(() => { + if (activeSectionId) { + router.replace(`#${activeSectionId}`, { scroll: false }) + } + }, [activeSectionId, router]) + return (