feat: SW-2398 UI updates booking codes * feat: SW-2398 UI updates booking codes * feat: SW-2398 Rate cards UI changes * feat: SW-2398 Optimized css with vars and chip code * feat: SW-2398 Optimized code as review comments * feat: SW-2398 Optimized code * feat: SW-2398 Optimized code and mobile UX * feat: SW-2398 Optimized code * feat: SW-2398 Fixed UI * feat: SW-2398 Updated animation Approved-by: Erik Tiekstra
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
|
|
|
import BookingCodeChip from "@/components/BookingCodeChip"
|
|
import SkeletonShimmer from "@/components/SkeletonShimmer"
|
|
import Divider from "@/components/TempDesignSystem/Divider"
|
|
|
|
import PriceDetails from "../../PriceDetails"
|
|
|
|
import styles from "./totalPrice.module.css"
|
|
|
|
export default function TotalPrice() {
|
|
const intl = useIntl()
|
|
const { rooms, formattedTotalCost } = useBookingConfirmationStore(
|
|
(state) => ({
|
|
rooms: state.rooms,
|
|
formattedTotalCost: state.formattedTotalCost,
|
|
})
|
|
)
|
|
|
|
const hasAllRoomsLoaded = rooms.every((room) => room)
|
|
const bookingCode = rooms.find((room) => room?.bookingCode)?.bookingCode
|
|
|
|
return (
|
|
<>
|
|
<Divider color="primaryLightSubtle" />
|
|
<div className={styles.price}>
|
|
<div className={styles.entry}>
|
|
<Typography variant="Body/Paragraph/mdBold">
|
|
<p>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Total price",
|
|
})}
|
|
</p>
|
|
</Typography>
|
|
{hasAllRoomsLoaded ? (
|
|
<Typography variant="Body/Paragraph/mdBold">
|
|
<p>{formattedTotalCost}</p>
|
|
</Typography>
|
|
) : (
|
|
<SkeletonShimmer width={"25%"} />
|
|
)}
|
|
</div>
|
|
{hasAllRoomsLoaded ? (
|
|
<PriceDetails />
|
|
) : (
|
|
<div className={styles.priceDetailsLoader}>
|
|
<SkeletonShimmer width={"100%"} />
|
|
</div>
|
|
)}
|
|
</div>
|
|
{bookingCode && <BookingCodeChip bookingCode={bookingCode} alignCenter />}
|
|
</>
|
|
)
|
|
}
|