feat(Sw-713): conditional rendering
This commit is contained in:
@@ -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}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RoomData } from "@/types/hotel"
|
||||
|
||||
export type RoomSidePeekProps = {
|
||||
selectedRoom?: RoomData
|
||||
selectedRoom: RoomData
|
||||
buttonSize: "small" | "medium"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user