feat(sw-453): fixed mobile view and some improvements
This commit is contained in:
@@ -2,6 +2,8 @@ import { useIntl } from "react-intl"
|
||||
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
|
||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||
|
||||
import styles from "./rateSummary.module.css"
|
||||
@@ -13,12 +15,19 @@ export default function RateSummary({
|
||||
rateSummary,
|
||||
isUserLoggedIn,
|
||||
packages,
|
||||
roomsAvailability,
|
||||
}: RateSummaryProps) {
|
||||
const intl = useIntl()
|
||||
const {
|
||||
member,
|
||||
public: publicRate,
|
||||
features,
|
||||
roomType,
|
||||
priceName,
|
||||
} = rateSummary
|
||||
const priceToShow = isUserLoggedIn ? member : publicRate
|
||||
|
||||
const priceToShow = isUserLoggedIn ? rateSummary.member : rateSummary.public
|
||||
|
||||
const isPetRoomSelect = rateSummary.features.some(
|
||||
const isPetRoomSelect = features.some(
|
||||
(feature) => feature.code === RoomPackageCodeEnum.PETR
|
||||
)
|
||||
|
||||
@@ -26,17 +35,23 @@ export default function RateSummary({
|
||||
(pkg) => pkg.code === RoomPackageCodeEnum.PETR
|
||||
)
|
||||
|
||||
const petRoomPrice = petRoomPackage ? petRoomPackage.calculatedPrice : null
|
||||
const petRoomCurrency = petRoomPackage ? petRoomPackage.currency : null
|
||||
const petRoomPrice = petRoomPackage?.calculatedPrice ?? null
|
||||
const petRoomCurrency = petRoomPackage?.currency ?? null
|
||||
|
||||
const checkInDate = new Date(roomsAvailability.checkInDate)
|
||||
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
||||
const nights = Math.ceil(
|
||||
(checkOutDate.getTime() - checkInDate.getTime()) / (1000 * 60 * 60 * 24)
|
||||
)
|
||||
|
||||
return (
|
||||
<div className={styles.summary}>
|
||||
<div className={styles.summaryText}>
|
||||
<Subtitle color="uiTextHighContrast">{rateSummary.roomType}</Subtitle>
|
||||
<Body color="uiTextMediumContrast">{rateSummary.priceName}</Body>
|
||||
<Subtitle color="uiTextHighContrast">{roomType}</Subtitle>
|
||||
<Body color="uiTextMediumContrast">{priceName}</Body>
|
||||
</div>
|
||||
<div className={styles.summaryPrice}>
|
||||
<div className={styles.summaryPriceText}>
|
||||
<div className={styles.summaryPriceTextDesktop}>
|
||||
<Subtitle color={isUserLoggedIn ? "red" : "uiTextHighContrast"}>
|
||||
{priceToShow?.localPrice.pricePerStay}{" "}
|
||||
{priceToShow?.localPrice.currency}
|
||||
@@ -47,6 +62,38 @@ export default function RateSummary({
|
||||
{priceToShow?.requestedPrice?.currency}
|
||||
</Body>
|
||||
</div>
|
||||
<div className={styles.summaryPriceTextMobile}>
|
||||
<Caption color="uiTextHighContrast">
|
||||
{intl.formatMessage({ id: "Total price" })}
|
||||
</Caption>
|
||||
<Subtitle color={isUserLoggedIn ? "red" : "uiTextHighContrast"}>
|
||||
{priceToShow?.localPrice.pricePerStay}{" "}
|
||||
{priceToShow?.localPrice.currency}
|
||||
</Subtitle>
|
||||
<Footnote
|
||||
color="uiTextMediumContrast"
|
||||
className={styles.summaryPriceTextMobile}
|
||||
>
|
||||
{intl.formatMessage(
|
||||
{ id: "booking.nights" },
|
||||
{ totalNights: nights }
|
||||
)}
|
||||
,{" "}
|
||||
{intl.formatMessage(
|
||||
{ id: "booking.adults" },
|
||||
{ totalAdults: roomsAvailability.occupancy?.adults }
|
||||
)}
|
||||
{roomsAvailability.occupancy?.children && (
|
||||
<>
|
||||
,{" "}
|
||||
{intl.formatMessage(
|
||||
{ id: "booking.children" },
|
||||
{ totalChildren: roomsAvailability.occupancy.children }
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Footnote>
|
||||
</div>
|
||||
{isPetRoomSelect && (
|
||||
<div className={styles.petInfo}>
|
||||
<Body color="uiTextHighContrast" textTransform="bold">
|
||||
@@ -57,7 +104,7 @@ export default function RateSummary({
|
||||
</Body>
|
||||
</div>
|
||||
)}
|
||||
<Button type="submit" theme="base">
|
||||
<Button type="submit" theme="base" className={styles.continueButton}>
|
||||
{intl.formatMessage({ id: "Continue" })}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user