31 lines
886 B
TypeScript
31 lines
886 B
TypeScript
import type { ImageItem } from "@/types/components/lightbox/lightbox"
|
|
import type { Hotel } from "@/types/hotel"
|
|
|
|
export function extractHotelImages(hotelData: Hotel): ImageItem[] {
|
|
const images: ImageItem[] = []
|
|
|
|
if (hotelData.hotelContent?.images) {
|
|
images.push({
|
|
url: hotelData.hotelContent.images.imageSizes.large,
|
|
alt: hotelData.hotelContent.images.metaData.altText,
|
|
title:
|
|
hotelData.hotelContent.images.metaData.title ||
|
|
hotelData.hotelContent.images.metaData.altText,
|
|
})
|
|
}
|
|
|
|
if (hotelData.healthFacilities) {
|
|
hotelData.healthFacilities.forEach((facility) => {
|
|
facility.content.images.forEach((image) => {
|
|
images.push({
|
|
url: image.imageSizes.large,
|
|
alt: image.metaData.altText,
|
|
title: image.metaData.title || image.metaData.altText,
|
|
})
|
|
})
|
|
})
|
|
}
|
|
|
|
return images
|
|
}
|