From dc5746a902e0711dce94068fd7757f363bb06bec Mon Sep 17 00:00:00 2001 From: Fredrik Thorsson Date: Mon, 18 Nov 2024 12:13:23 +0100 Subject: [PATCH] feat(SW-880): refactor variables --- .../WellnessAndExercise/Facility/index.tsx | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/components/ContentType/HotelPage/SidePeeks/WellnessAndExercise/Facility/index.tsx b/components/ContentType/HotelPage/SidePeeks/WellnessAndExercise/Facility/index.tsx index 474ccb901..e00ed5964 100644 --- a/components/ContentType/HotelPage/SidePeeks/WellnessAndExercise/Facility/index.tsx +++ b/components/ContentType/HotelPage/SidePeeks/WellnessAndExercise/Facility/index.tsx @@ -10,26 +10,16 @@ import { FacilityProps } from "@/types/components/hotelPage/sidepeek/facility" export default async function Facility({ data }: FacilityProps) { const intl = await getIntl() - const imgUrl = data.content.images[0]?.imageSizes.medium - const imgAltText = data.content.images[0]?.metaData.altText - const facilityType = data.type - const ordinaryOpeningTimes = { - alwaysOpen: data.openingDetails.openingHours.ordinary.alwaysOpen, - openingTime: data.openingDetails.openingHours.ordinary.openingTime, - closingTime: data.openingDetails.openingHours.ordinary.closingTime, - } - const weekendOpeningTimes = { - alwaysOpen: data.openingDetails.openingHours.weekends.alwaysOpen, - openingTime: data.openingDetails.openingHours.weekends.openingTime, - closingTime: data.openingDetails.openingHours.weekends.closingTime, - } + const image = data.content.images[0] + const ordinaryOpeningTimes = data.openingDetails.openingHours.ordinary + const weekendOpeningTimes = data.openingDetails.openingHours.weekends return (
- {imgUrl && ( + {image.imageSizes.medium && ( {imgAltText - - {intl.formatMessage({ id: `${facilityType}` })} - + {intl.formatMessage({ id: `${data.type}` })}