From 1767fe2f4a0371e46b2d8b03bca27ba9ef945cd7 Mon Sep 17 00:00:00 2001 From: Chuma McPhoy Date: Fri, 6 Sep 2024 11:48:08 +0200 Subject: [PATCH] refactor(SW-337): conditional rendering of image titles --- components/Lightbox/FullView.tsx | 2 +- components/Lightbox/Gallery.tsx | 4 +++- server/routers/utils/hotels.ts | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/Lightbox/FullView.tsx b/components/Lightbox/FullView.tsx index 983269463..73f6dde98 100644 --- a/components/Lightbox/FullView.tsx +++ b/components/Lightbox/FullView.tsx @@ -56,7 +56,7 @@ export default function FullView({ />
- {image.title} + {image.title && {image.title}}
diff --git a/components/Lightbox/Gallery.tsx b/components/Lightbox/Gallery.tsx index cb5181d39..0c151e420 100644 --- a/components/Lightbox/Gallery.tsx +++ b/components/Lightbox/Gallery.tsx @@ -58,7 +58,9 @@ export default function Gallery({
- {mainImage.title} + {mainImage.title && ( + {mainImage.title} + )}
diff --git a/server/routers/utils/hotels.ts b/server/routers/utils/hotels.ts index b39f37545..37ae167cb 100644 --- a/server/routers/utils/hotels.ts +++ b/server/routers/utils/hotels.ts @@ -15,8 +15,8 @@ export function extractHotelImages(hotelData: Hotel): ImageItem[] { } if (hotelData.healthFacilities) { - hotelData.healthFacilities.forEach((facility: any) => { - facility.content.images.forEach((image: any) => { + hotelData.healthFacilities.forEach((facility) => { + facility.content.images.forEach((image) => { images.push({ url: image.imageSizes.large, alt: image.metaData.altText,