Merged in fix/room-card (pull request #938)

Fix: hide occupancy and roomSize if undefined, and show placeholder image

Approved-by: Niclas Edenvin
This commit is contained in:
Pontus Dreij
2024-11-19 14:38:10 +00:00
2 changed files with 50 additions and 48 deletions

View File

@@ -60,7 +60,6 @@ export default function RoomCard({
const getBreakfastMessage = (rate: RateDefinition | undefined) => { const getBreakfastMessage = (rate: RateDefinition | undefined) => {
const breakfastIncluded = getRateDefinitionForRate(rate)?.breakfastIncluded const breakfastIncluded = getRateDefinitionForRate(rate)?.breakfastIncluded
switch (breakfastIncluded) { switch (breakfastIncluded) {
case true: case true:
return intl.formatMessage({ id: "Breakfast is included." }) return intl.formatMessage({ id: "Breakfast is included." })
@@ -83,7 +82,6 @@ export default function RoomCard({
) )
const { roomSize, occupancy, images } = selectedRoom || {} const { roomSize, occupancy, images } = selectedRoom || {}
const mainImage = images?.[0]
const freeCancelation = intl.formatMessage({ id: "Free cancellation" }) const freeCancelation = intl.formatMessage({ id: "Free cancellation" })
const nonRefundable = intl.formatMessage({ id: "Non-refundable" }) const nonRefundable = intl.formatMessage({ id: "Non-refundable" })
@@ -115,7 +113,6 @@ export default function RoomCard({
return ( return (
<div className={classNames}> <div className={classNames}>
<div> <div>
{mainImage && (
<div className={styles.imageContainer}> <div className={styles.imageContainer}>
<div className={styles.chipContainer}> <div className={styles.chipContainer}>
{roomConfiguration.roomsLeft < 5 && ( {roomConfiguration.roomsLeft < 5 && (
@@ -146,8 +143,9 @@ export default function RoomCard({
fill fill
/> />
</div> </div>
)}
<div className={styles.specification}> <div className={styles.specification}>
{occupancy && (
<Caption color="uiTextMediumContrast" className={styles.guests}> <Caption color="uiTextMediumContrast" className={styles.guests}>
{intl.formatMessage( {intl.formatMessage(
{ {
@@ -156,12 +154,15 @@ export default function RoomCard({
{ nrOfGuests: occupancy?.total } { nrOfGuests: occupancy?.total }
)} )}
</Caption> </Caption>
)}
{roomSize && (
<Caption color="uiTextMediumContrast"> <Caption color="uiTextMediumContrast">
{roomSize?.min === roomSize?.max {roomSize.min === roomSize.max
? roomSize?.min ? roomSize.min
: `${roomSize?.min}-${roomSize?.max}`} : `${roomSize.min}-${roomSize.max}`}
m² m²
</Caption> </Caption>
)}
<div className={styles.toggleSidePeek}> <div className={styles.toggleSidePeek}>
{roomConfiguration.roomTypeCode && ( {roomConfiguration.roomTypeCode && (
<ToggleSidePeek <ToggleSidePeek

View File

@@ -7,6 +7,7 @@
border: 1px solid var(--Base-Border-Subtle); border: 1px solid var(--Base-Border-Subtle);
position: relative; position: relative;
height: 100%; height: 100%;
min-height: 730px;
justify-content: space-between; justify-content: space-between;
} }