feat(Sw-713): conditional rendering

This commit is contained in:
Fredrik Thorsson
2024-10-30 12:56:53 +01:00
parent e3a96a2c14
commit 4106f9a91d
2 changed files with 5 additions and 2 deletions

View File

@@ -57,6 +57,7 @@ export default function RoomCard({
const selectedRoom = roomCategories.find(
(room) => room.name === roomConfiguration.roomType
)
const { roomSize, occupancy, descriptions, images } = selectedRoom || {}
const mainImage = images?.[0]
@@ -78,7 +79,9 @@ export default function RoomCard({
: `${roomSize?.min}-${roomSize?.max}`}
m²
</Caption>
<RoomSidePeek selectedRoom={selectedRoom} buttonSize="small" />
{selectedRoom && (
<RoomSidePeek selectedRoom={selectedRoom} buttonSize="small" />
)}
</div>
<div className={styles.container}>
<div className={styles.roomDetails}>

View File

@@ -1,6 +1,6 @@
import { RoomData } from "@/types/hotel"
export type RoomSidePeekProps = {
selectedRoom?: RoomData
selectedRoom: RoomData
buttonSize: "small" | "medium"
}