feat(SW-880): add function for type mapping

This commit is contained in:
Fredrik Thorsson
2024-11-14 11:35:02 +01:00
parent cf0173ef57
commit 32c444117d
8 changed files with 48 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
import { getIntl } from "@/i18n"
export async function getType(type: string) {
const intl = await getIntl()
switch (type) {
case "OutdoorPool":
return intl.formatMessage({ id: "Outdoor pool" })
case "Sauna":
return intl.formatMessage({ id: "Sauna" })
case "Relax":
return intl.formatMessage({ id: "Relax" })
case "Gym":
return intl.formatMessage({ id: "Gym" })
default:
return type
}
}

View File

@@ -10,6 +10,8 @@ import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { getType } from "../Utils/getType"
import styles from "./wellnessAndExercise.module.css"
import { WellnessAndExerciseSidePeekProps } from "@/types/components/hotelPage/sidepeek/wellnessAndExercise"
@@ -36,19 +38,19 @@ export default async function WellnessAndExerciseSidePeek({
width={200}
/>
<div className={styles.information}>
<Subtitle color="burgundy" asChild>
<Title level="h3">{facility.type}</Title>
<Subtitle color="burgundy" asChild type="one">
<Title level="h3">{getType(facility.type)}</Title>
</Subtitle>
<div>
<Subtitle>
<Subtitle type="two" color="uiTextHighContrast">
{intl.formatMessage({ id: " Opening Hours" })}
</Subtitle>
<Body className={styles.body}>
<Body color="uiTextHighContrast" className={styles.body}>
{facility.openingDetails.openingHours.ordinary.alwaysOpen
? `${intl.formatMessage({ id: "Mon-Fri" })} ${intl.formatMessage({ id: "Always open" })}`
: `${intl.formatMessage({ id: "Mon-Fri" })} ${facility.openingDetails.openingHours.ordinary.openingTime}-${facility.openingDetails.openingHours.ordinary.closingTime}`}
</Body>
<Body>
<Body color="uiTextHighContrast">
{facility.openingDetails.openingHours.weekends.alwaysOpen
? `${intl.formatMessage({ id: "Sat-Sun" })} ${intl.formatMessage({ id: "Always open" })}`
: `${intl.formatMessage({ id: "Sat-Sun" })} ${facility.openingDetails.openingHours.weekends.openingTime}-${facility.openingDetails.openingHours.weekends.closingTime}`}