import { cx } from "class-variance-authority" import { useIntl } from "react-intl" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Typography } from "@scandic-hotels/design-system/Typography" import styles from "./row.module.css" import type { Price } from "../../../../types/price" interface RowProps { allPricesIsDiscounted: boolean label: string price: Price } export default function LargeRow({ allPricesIsDiscounted, label, price, }: RowProps) { const intl = useIntl() const totalPrice = formatPrice( intl, price.local.price, price.local.currency, price.local.additionalPrice, price.local.additionalPriceCurrency ) const regularPrice = price.local.regularPrice ? formatPrice( intl, price.local.regularPrice, price.local.currency, price.local.additionalPrice, price.local.additionalPriceCurrency ) : null const isDiscounted = allPricesIsDiscounted || (price.local.regularPrice !== undefined && price.local.regularPrice > price.local.price) return ( {label} {isDiscounted && regularPrice ? ( <> {regularPrice} ) : null} {totalPrice} ) }