feat(SW-880): add function for type mapping
This commit is contained in:
17
components/ContentType/HotelPage/SidePeeks/Utils/getType.ts
Normal file
17
components/ContentType/HotelPage/SidePeeks/Utils/getType.ts
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -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}`}
|
||||
|
||||
Reference in New Issue
Block a user