"use client" import { useState } from "react" import { useIntl } from "react-intl" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Image from "@scandic-hotels/design-system/Image" import ImageFallback from "@scandic-hotels/design-system/ImageFallback" import { Typography } from "@scandic-hotels/design-system/Typography" import ShowMoreButton from "../ShowMoreButton" import { translateRoomLighting, translateSeatingType } from "./utils" import styles from "./meetingRoomCard.module.css" import type { MeetingRoom } from "@/types/components/hotelPage/meetingRooms" interface MeetingRoomCardProps { room: MeetingRoom } export default function MeetingRoomCard({ room }: MeetingRoomCardProps) { const intl = useIntl() const [opened, setOpened] = useState(false) 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() { setOpened((state) => !state) } return (
{image?.src ? ( {image.altText ) : ( )}

{room.name}

{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {room.size} m²
{maxSeatings ? (
{intl.formatMessage( { id: "meetingRoomCard.maxSeatings", defaultMessage: "max {seatings} pers", }, { seatings: maxSeatings } )}
) : 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}
)}
) } function TableRow({ name, value, id, }: { name: string value: string id?: string }) { return ( {name} {value} ) }