73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
"use client"
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import styles from "./summaryBreakfast.module.css"
|
|
|
|
interface BreakfastProps {
|
|
breakfastPrice: number | false | undefined
|
|
breakfastCurrency?: string | null
|
|
breakfastIncluded: boolean
|
|
guests: string
|
|
hotelOffersBreakfast: boolean
|
|
}
|
|
|
|
export function SummaryBreakfast({
|
|
breakfastPrice,
|
|
breakfastCurrency,
|
|
breakfastIncluded,
|
|
guests,
|
|
hotelOffersBreakfast = true,
|
|
}: BreakfastProps) {
|
|
const intl = useIntl()
|
|
|
|
const breakfastBuffet = intl.formatMessage({
|
|
id: "common.breakfastBuffet",
|
|
defaultMessage: "Breakfast buffet",
|
|
})
|
|
|
|
if (breakfastIncluded || (breakfastPrice && breakfastCurrency)) {
|
|
const price =
|
|
breakfastPrice && breakfastCurrency
|
|
? formatPrice(intl, breakfastPrice, breakfastCurrency)
|
|
: intl.formatMessage({
|
|
id: "common.included",
|
|
defaultMessage: "Included",
|
|
})
|
|
return (
|
|
<div className={styles.entry}>
|
|
<div>
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p className={styles.textDefault}>{breakfastBuffet}</p>
|
|
</Typography>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<p className={styles.textSecondary}>{guests}</p>
|
|
</Typography>
|
|
</div>
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p className={styles.textDefault}>{price}</p>
|
|
</Typography>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (breakfastPrice === false) {
|
|
const noBreakfast = intl.formatMessage({
|
|
id: "common.noBreakfast",
|
|
defaultMessage: "No breakfast",
|
|
})
|
|
return (
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<div className={`${styles.entry} ${styles.textDefault}`}>
|
|
{hotelOffersBreakfast ? <p>{breakfastBuffet}</p> : null}
|
|
<p>{noBreakfast}</p>
|
|
</div>
|
|
</Typography>
|
|
)
|
|
}
|
|
|
|
return null
|
|
}
|