From 899439ead8abce29c3cabf2f24460bfa01e32b6d Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Tue, 8 Jul 2025 12:53:06 +0000 Subject: [PATCH] Merged in fix/SW-3007-meeting-image-max-seatings (pull request #2528) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(SW-3007): Added fallback image and check if maxSeatings exists * fix(SW-3007): Added fallback image and check if maxSeatings exists * fix(SW-3007): use image fallback component * fix(SW-3007): change to new tokens * fix(SW-3007): change to table structure Approved-by: Hrishikesh Vaipurkar Approved-by: Matilda Landström --- .../ImageFallback/imageFallback.module.css | 8 + .../components/ImageFallback/index.tsx | 23 ++ .../ImageGallery/imageGallery.module.css | 12 - .../components/ImageGallery/index.tsx | 8 +- .../MeetingRoomCard/index.tsx | 238 +++++++++--------- .../meetingRoomCard.module.css | 24 +- 6 files changed, 173 insertions(+), 140 deletions(-) create mode 100644 apps/scandic-web/components/ImageFallback/imageFallback.module.css create mode 100644 apps/scandic-web/components/ImageFallback/index.tsx diff --git a/apps/scandic-web/components/ImageFallback/imageFallback.module.css b/apps/scandic-web/components/ImageFallback/imageFallback.module.css new file mode 100644 index 000000000..4e27868d4 --- /dev/null +++ b/apps/scandic-web/components/ImageFallback/imageFallback.module.css @@ -0,0 +1,8 @@ +.imageFallback { + display: flex; + align-items: center; + justify-content: center; + height: 200px; + width: 100%; + background-color: var(--Surface-Feedback-Neutral); +} diff --git a/apps/scandic-web/components/ImageFallback/index.tsx b/apps/scandic-web/components/ImageFallback/index.tsx new file mode 100644 index 000000000..16cb9d74f --- /dev/null +++ b/apps/scandic-web/components/ImageFallback/index.tsx @@ -0,0 +1,23 @@ +import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" + +import styles from "./imageFallback.module.css" + +interface ImageFallbackProps { + width?: string + height?: string +} + +export default function ImageFallback({ + width = "100%", + height = "200px", +}: ImageFallbackProps) { + return ( +
+ +
+ ) +} diff --git a/apps/scandic-web/components/ImageGallery/imageGallery.module.css b/apps/scandic-web/components/ImageGallery/imageGallery.module.css index 20e53cb6f..674466f5c 100644 --- a/apps/scandic-web/components/ImageGallery/imageGallery.module.css +++ b/apps/scandic-web/components/ImageGallery/imageGallery.module.css @@ -45,15 +45,3 @@ object-fit: cover; border-radius: inherit; } - -.imagePlaceholder { - height: 100%; - min-height: 190px; - width: 100%; - background-color: var(--Surface-Feedback-Neutral); - border-radius: inherit; - color: var(--Icon-Interactive-Disabled); - display: flex; - align-items: center; - justify-content: center; -} diff --git a/apps/scandic-web/components/ImageGallery/index.tsx b/apps/scandic-web/components/ImageGallery/index.tsx index 68af78a6f..a8c1850d8 100644 --- a/apps/scandic-web/components/ImageGallery/index.tsx +++ b/apps/scandic-web/components/ImageGallery/index.tsx @@ -10,6 +10,8 @@ import { Typography } from "@scandic-hotels/design-system/Typography" import Image from "@/components/Image" import Lightbox from "@/components/Lightbox" +import ImageFallback from "../ImageFallback" + import styles from "./imageGallery.module.css" import type { ImageGalleryProps } from "@/types/components/imageGallery" @@ -29,11 +31,7 @@ function ImageGallery({ const imageProps = fill ? { fill, sizes } : { height, width: height * 1.5 } if (!images || images.length === 0 || imageError) { - return ( -
- -
- ) + return } const firstImage = images[0] diff --git a/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/index.tsx b/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/index.tsx index b6adda481..6eb1422b2 100644 --- a/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/index.tsx +++ b/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/index.tsx @@ -2,13 +2,12 @@ import { useState } from "react" import { useIntl } from "react-intl" -import Body from "@scandic-hotels/design-system/Body" -import Caption from "@scandic-hotels/design-system/Caption" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" -import Subtitle from "@scandic-hotels/design-system/Subtitle" +import { Typography } from "@scandic-hotels/design-system/Typography" import Image from "@/components/Image" +import ImageFallback from "@/components/ImageFallback" import ShowMoreButton from "../ShowMoreButton" import { translateRoomLighting, translateSeatingType } from "./utils" @@ -24,11 +23,10 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) { const intl = useIntl() const [opened, setOpened] = useState(false) - const roomSeatings = room.seatings.map((seating) => { - return seating.capacity - }) - - const maxSeatings = Math.max(...roomSeatings) + const roomSeatings = room.seatings + .filter(({ capacity }) => !!capacity) + .map(({ capacity }) => capacity) + const maxSeatings = roomSeatings.length ? Math.max(...roomSeatings) : null const image = room.content.images.at(0) function handleShowMore() { @@ -37,128 +35,120 @@ export default function MeetingRoomCard({ room }: MeetingRoomCardProps) { return (
- {image?.metaData.altText + {image?.imageSizes.small ? ( + {image?.metaData.altText + ) : ( + + )}
- - {room.name} - + +

{room.name}

+
- {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} - {room.size} m² + + {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} + {room.size} m² +
-
- - - {intl.formatMessage( - { - defaultMessage: "max {seatings} pers", - }, - { seatings: maxSeatings } - )} - -
-
- {room.content.texts.descriptions.medium ? ( - - {room.content.texts.descriptions.medium} - - ) : null} - {opened && ( -
-
- {room.seatings.map((seating, idx) => ( -
- - {translateSeatingType(seating.type, intl)} - - - {intl.formatMessage( - { - defaultMessage: "{number} people", - }, - { number: seating.capacity } - )} - -
- ))} -
- -
-
- - {intl.formatMessage({ - defaultMessage: "Location in hotel", - })} - - + {maxSeatings ? ( +
+ + + {intl.formatMessage( { - defaultMessage: "Floor {floorNumber}", + defaultMessage: "max {seatings} pers", }, - { - floorNumber: `${room.floorNumber}`, - } + { seatings: maxSeatings } )} - -
-
- - {intl.formatMessage({ - defaultMessage: "Lighting", - })} - - - {translateRoomLighting(room.lighting, intl)} - -
+ + +
+ ) : null} +
+ {room.content.texts.descriptions.medium ? ( + +

{room.content.texts.descriptions.medium}

+
+ ) : null} + {opened && ( + + + {room.seatings.map((seating, idx) => ( + + ))} + + + + + {room.doorHeight && room.doorWidth ? ( -
-
- - + ) : null} {room.length && room.width && room.height ? ( -
-
- - + ) : null} - - + +
- {intl.formatMessage({ - defaultMessage: "Access size", - })} - - {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} - {room.doorHeight} x {room.doorWidth} m - - {intl.formatMessage({ - defaultMessage: "Dimensions", - })} - - {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} - {room.length} x {room.width} x {room.height} m -
)} + + {name} + {value} + + + ) +} diff --git a/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/meetingRoomCard.module.css b/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/meetingRoomCard.module.css index c95ceb861..e5b0f176a 100644 --- a/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/meetingRoomCard.module.css +++ b/apps/scandic-web/components/TempDesignSystem/MeetingRoomCard/meetingRoomCard.module.css @@ -10,26 +10,27 @@ .capacity { display: grid; grid-template-columns: 1fr 1fr; - gap: var(--Spacing-x1); + gap: var(--Space-x1); + text-align: left; } .iconText { display: flex; - gap: var(--Spacing-x-half); + gap: var(--Space-x05); align-items: center; } .rowItem { display: grid; - gap: var(--Spacing-x-half); + gap: var(--Space-x05); } .openedInfo { background-color: var(--Base-Surface-Secondary-light-Normal); border-radius: var(--Corner-radius-md); - padding: var(--Spacing-x2); + padding: var(--Space-x2); display: grid; - gap: var(--Spacing-x2); + gap: var(--Space-x2); } .image { @@ -40,12 +41,21 @@ .content { display: grid; - gap: var(--Spacing-x2); - padding: var(--Spacing-x2); + gap: var(--Space-x2); + padding: var(--Space-x2); grid-template-rows: auto 1fr auto; flex-grow: 1; } +.roomDetails { + color: var(--Text-Tertiary); +} + +.leftColumn { + color: var(--Text-Secondary); + font-weight: inherit; +} + @media (min-width: 1367px) { .card:not(.alwaysStack) .ctaContainer { grid-template-columns: repeat(auto-fit, minmax(0, 1fr));