feat(SW-72): move the room selection to its own component
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./roomCard.module.css"
|
||||
|
||||
import { RoomCardProps } from "@/types/components/hotelReservation/selectRate/roomCard"
|
||||
|
||||
export default async function RoomCard({ room }: RoomCardProps) {
|
||||
const { formatMessage } = await getIntl()
|
||||
return (
|
||||
<div className={styles.card}>
|
||||
<div className={styles.cardBody}>
|
||||
<div>
|
||||
<Title className={styles.name} as="h5" level="h3">
|
||||
{room.name}
|
||||
</Title>
|
||||
<div className={styles.nameInfo}>i</div>
|
||||
</div>
|
||||
<Caption color="burgundy">{room.size}</Caption>
|
||||
<Caption color="burgundy">{room.description}</Caption>
|
||||
|
||||
<Caption color="burgundy">
|
||||
{/* TODO: Handle currency and this whole line of text in a better way through intl */}
|
||||
{formatMessage({ id: "From" })}{" "}
|
||||
<span className={styles.price}>{room.pricePerNight}</span>{" "}
|
||||
{room.currency}/{formatMessage({ id: "night" })}
|
||||
</Caption>
|
||||
|
||||
<Button
|
||||
asChild
|
||||
type="button"
|
||||
size="small"
|
||||
theme="primaryDark"
|
||||
className={styles.button}
|
||||
>
|
||||
<label htmlFor={`room-${room.id}`}>
|
||||
{formatMessage({ id: "Choose room" })}
|
||||
</label>
|
||||
</Button>
|
||||
</div>
|
||||
{/* TODO: maybe use the `Image` component instead of the `img` tag. Waiting until we know how to get the image */}
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
alt={formatMessage({ id: "A photo of the room" })}
|
||||
src={room.imageSrc}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
.card {
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
background-color: #fff;
|
||||
border-radius: var(--Corner-radius-Small);
|
||||
border: 1px solid rgba(77, 0, 27, 0.1);
|
||||
}
|
||||
|
||||
.cardBody {
|
||||
padding: var(--Spacing-x2);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Spacing-x1);
|
||||
}
|
||||
|
||||
.name {
|
||||
display: inline-block;
|
||||
}
|
||||
.nameInfo {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card .button {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.card img {
|
||||
max-width: 100%;
|
||||
aspect-ratio: 2.45;
|
||||
object-fit: cover;
|
||||
}
|
||||
Reference in New Issue
Block a user