feat(SW-72): move the room selection to its own component

This commit is contained in:
Niclas Edenvin
2024-07-10 10:51:15 +02:00
parent 6b5606fc8b
commit 8e94c92c70
7 changed files with 75 additions and 56 deletions

View File

@@ -0,0 +1,45 @@
import Header from "@/components/Section/Header"
import { getIntl } from "@/i18n"
import RoomCard from "./RoomCard"
import styles from "./roomSelection.module.css"
import { RoomSelectionProps } from "@/types/components/hotelReservation/selectRate/roomSelection"
export default async function RoomSelection({ rooms }: RoomSelectionProps) {
const { formatMessage } = await getIntl()
return (
<div>
<div className={styles.header}>
<Header
title={formatMessage({ id: "Choose room" })}
subtitle={formatMessage({
id: "Which room class suits you the best?",
})}
link={{
href: "#",
text: formatMessage({
id: "All rooms comes with standard amenities",
}),
}}
/>
</div>
<ul className={styles.roomList}>
{rooms.map((room) => (
<li key={room.id}>
<input
type="radio"
name="room"
value={room.id}
id={`room-${room.id}`}
/>
<RoomCard room={room} />
</li>
))}
</ul>
</div>
)
}

View File

@@ -0,0 +1,23 @@
.header {
margin-top: var(--Spacing-x2);
margin-bottom: var(--Spacing-x2);
}
.roomList {
margin-top: var(--Spacing-x4);
list-style: none;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
column-gap: var(--Spacing-x2);
row-gap: var(--Spacing-x4);
}
.roomList > li {
width: 100%;
}
.roomList input[type="radio"] {
opacity: 0;
position: fixed;
width: 0;
}