feat(SW-70): create base for rate selection page

This is the foundation for the rate selection. Since we don't have UX
and UI ready yet this is on a best effort basis. Things that will be
changed later includes proper API fetching, correct design,
internationalization of text and form handling.
This commit is contained in:
Niclas Edenvin
2024-07-08 11:06:58 +02:00
parent bb422f804d
commit d6fe6a33b4
9 changed files with 264 additions and 11 deletions

View File

@@ -0,0 +1,42 @@
import Button from "@/components/TempDesignSystem/Button"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import Title from "@/components/TempDesignSystem/Text/Title"
import { RoomProps } from "./roomCard"
import styles from "./roomCard.module.css"
export default function RoomCard({ room }: RoomProps) {
return (
<div className={styles.card}>
<div className={styles.cardBody}>
<div className={styles.nameContainer}>
<Title className={styles.name} as="h5" level="h3">
{room.name}
</Title>
<div className={styles.nameInfo}>i</div>
</div>
<Caption color="burgundy">17 - 24 m² (1 - 2 persons)</Caption>
<Caption color="burgundy">{room.description}</Caption>
<Caption color="burgundy">
From <span className={styles.price}>{room.pricePerNight}</span>{" "}
{room.currency}/night
</Caption>
<Button
asChild
type="button"
size="small"
theme="primaryDark"
className={styles.button}
>
<label htmlFor={`room-${room.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="A photo of the room" src={room.imageSrc} />
</div>
)
}

View File

@@ -0,0 +1,42 @@
.card {
font-size: 14px;
text-align: center;
display: flex;
flex-direction: column-reverse;
background-color: #fff;
border-radius: 4px;
border: 1px solid rgba(77, 0, 27, 0.1);
}
.cardBody {
padding: var(--Spacing-x2);
display: flex;
flex-direction: column;
gap: var(--Spacing-x1);
}
.nameContainer {
}
.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;
}

View File

@@ -0,0 +1,11 @@
export type Room = {
id: number
name: string
description: string
size: string
pricePerNight: number
currency: string
imageSrc: string
}
export type RoomProps = { room: Room }

View File

@@ -4,10 +4,17 @@ import { headingVariants } from "./variants"
import type { HeadingProps } from "./title"
export default function Title({
/**
* What styling to use, based on heading level. If not provided `level`
* will determine the styling.
*/
as,
children,
className = "",
color,
/**
* What HTML tag to use. Defaults to h1.
*/
level = "h1",
textAlign,
textTransform,