import Body from "@/components/TempDesignSystem/Text/Body" import { getIntl } from "@/i18n" import { formatPrice } from "@/utils/numberFormatting" import { getPeriod } from "./utils" import styles from "./parkingPrices.module.css" import { type ParkingPricesProps, Periods, } from "@/types/components/hotelPage/sidepeek/parking" export default async function ParkingPrices({ currency = "", freeParking, pricing, }: ParkingPricesProps) { const intl = await getIntl() return freeParking ? ( {intl.formatMessage({ defaultMessage: "Free parking", })} ) : (
{pricing?.map((parking) => (
{getPeriod(intl, parking.period)}
{parking.amount ? formatPrice(intl, parking.amount, currency) : intl.formatMessage({ defaultMessage: "At a cost", })}
{parking.startTime && parking.endTime && parking.period !== Periods.allDay && (
{intl.formatMessage({ defaultMessage: "From", })}
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{`${parking.startTime}-${parking.endTime}`}
)}
))}
) }