Feat(SW-2083) missing booking codes scenarios my stay * feat(SW-2083) Show points instead of reward nights * feat(SW-2083) added support for cheque and voucher for totalPrice Approved-by: Niclas Edenvin
40 lines
933 B
TypeScript
40 lines
933 B
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import { useMyStayTotalPriceStore } from "@/stores/my-stay/myStayTotalPrice"
|
|
|
|
import SkeletonShimmer from "@/components/SkeletonShimmer"
|
|
import { formatPrice } from "@/utils/numberFormatting"
|
|
|
|
import styles from "./price.module.css"
|
|
|
|
import type { Variant } from "../Rooms/TotalPrice"
|
|
|
|
export default function Price({
|
|
price,
|
|
variant,
|
|
isMember,
|
|
}: {
|
|
price: number | null
|
|
variant: Variant
|
|
isMember?: boolean
|
|
}) {
|
|
const intl = useIntl()
|
|
const currencyCode = useMyStayTotalPriceStore((state) => state.currencyCode)
|
|
|
|
if (price === null) {
|
|
return <SkeletonShimmer width={"100px"} />
|
|
}
|
|
|
|
return (
|
|
<Typography variant={variant}>
|
|
<p className={isMember ? styles.memberPrice : styles.nonMemberPrice}>
|
|
{formatPrice(intl, price, currencyCode)}
|
|
</p>
|
|
</Typography>
|
|
)
|
|
}
|