Files
web/apps/scandic-web/components/OpeningHours/index.tsx
T
Erik Tiekstra 4ff44311a9 feat(SW-1968): Alternate opening hours for restaurants
Approved-by: Matilda Landström
2025-03-26 08:04:37 +00:00

44 lines
1.2 KiB
TypeScript

import { Typography } from "@scandic-hotels/design-system/Typography"
import { getIntl } from "@/i18n"
import AlternateOpeningHours from "./AlternateOpeningHours"
import { getGroupedOpeningHours } from "./utils"
import styles from "./openingHours.module.css"
import type { OpeningHoursProps } from "@/types/components/hotelPage/sidepeek/openingHours"
export default async function OpeningHours({
openingHours,
alternateOpeningHours,
heading,
type = "default",
}: OpeningHoursProps) {
const intl = await getIntl()
const groupedOpeningHours = getGroupedOpeningHours(openingHours, intl)
return (
<div className={type === "default" ? styles.wrapper : ""}>
<Typography variant="Body/Paragraph/mdBold" className={styles.text}>
<h5>{heading ?? openingHours.name}</h5>
</Typography>
{groupedOpeningHours.map((groupedOpeningHour) => {
return (
<Typography
variant="Body/Paragraph/mdRegular"
className={styles.text}
key={groupedOpeningHour}
>
<p>{groupedOpeningHour}</p>
</Typography>
)
})}
{alternateOpeningHours ? (
<AlternateOpeningHours alternateOpeningHours={alternateOpeningHours} />
) : null}
</div>
)
}