feat(SW-1409): Synced tabnavigation headings and section headings on hotel pages
* feat(SW-2409): Added same headings to relevant sidepeeks Approved-by: Christian Andolf Approved-by: Matilda Landström
This commit is contained in:
@@ -11,9 +11,13 @@ import {
|
||||
RestaurantHeadings,
|
||||
WellnessHeadings,
|
||||
} from "@/types/components/hotelPage/facilities"
|
||||
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
|
||||
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
|
||||
import {
|
||||
type HotelHashValue,
|
||||
SidepeekSlugs,
|
||||
} from "@/types/components/hotelPage/hotelPage";
|
||||
import type { HotelPageSections } from "@/types/components/hotelPage/sections"
|
||||
import { FacilityEnum } from "@/types/enums/facilities"
|
||||
import { HotelHashValues } from "@/types/enums/hotelPage"
|
||||
import type {
|
||||
Amenities,
|
||||
Facility,
|
||||
@@ -26,24 +30,34 @@ export function setFacilityCards(
|
||||
restaurantImages: FacilityData | undefined,
|
||||
conferencesAndMeetings: FacilityData | undefined,
|
||||
healthAndWellness: FacilityData | undefined,
|
||||
hasRestaurants: boolean,
|
||||
hasMeetingRooms: boolean,
|
||||
hasWellness: boolean
|
||||
pageSections: HotelPageSections
|
||||
): Facility[] {
|
||||
const facilities = []
|
||||
if (hasRestaurants) {
|
||||
if (pageSections.restaurant) {
|
||||
facilities.push(
|
||||
setFacilityCard(restaurantImages, FacilityCardTypeEnum.restaurant)
|
||||
setFacilityCard(
|
||||
restaurantImages,
|
||||
FacilityCardTypeEnum.restaurant,
|
||||
pageSections.restaurant.heading
|
||||
)
|
||||
)
|
||||
}
|
||||
if (hasMeetingRooms) {
|
||||
if (pageSections.meetings) {
|
||||
facilities.push(
|
||||
setFacilityCard(conferencesAndMeetings, FacilityCardTypeEnum.conference)
|
||||
setFacilityCard(
|
||||
conferencesAndMeetings,
|
||||
FacilityCardTypeEnum.conference,
|
||||
pageSections.meetings.heading
|
||||
)
|
||||
)
|
||||
}
|
||||
if (hasWellness) {
|
||||
if (pageSections.wellness) {
|
||||
facilities.push(
|
||||
setFacilityCard(healthAndWellness, FacilityCardTypeEnum.wellness)
|
||||
setFacilityCard(
|
||||
healthAndWellness,
|
||||
FacilityCardTypeEnum.wellness,
|
||||
pageSections.wellness.heading
|
||||
)
|
||||
)
|
||||
}
|
||||
return facilities
|
||||
@@ -51,12 +65,13 @@ export function setFacilityCards(
|
||||
|
||||
function setFacilityCard(
|
||||
facility: FacilityData | undefined,
|
||||
type: FacilityCardTypeEnum
|
||||
type: FacilityCardTypeEnum,
|
||||
heading: string
|
||||
): Facility {
|
||||
return {
|
||||
...facility,
|
||||
id: type,
|
||||
headingText: facility?.headingText ?? "",
|
||||
headingText: heading,
|
||||
heroImages: facility?.heroImages ?? [],
|
||||
}
|
||||
}
|
||||
@@ -72,7 +87,7 @@ export function isFacilityImage(card: FacilityCardType): card is FacilityImage {
|
||||
function setCardProps(
|
||||
theme: CardProps["theme"],
|
||||
buttonText: (typeof FacilityCardButtonText)[keyof typeof FacilityCardButtonText],
|
||||
href: HotelHashValues,
|
||||
href: HotelHashValue,
|
||||
heading: string,
|
||||
slug: SidepeekSlugs,
|
||||
scriptedTopTitle?: string
|
||||
|
||||
Reference in New Issue
Block a user