feat(SW-252): add new ux

This commit is contained in:
Fredrik Thorsson
2024-08-26 11:45:14 +02:00
parent 8da332dcc3
commit 69ebf254d1
9 changed files with 193 additions and 79 deletions

View File

@@ -1,76 +1,111 @@
.card {
display: grid;
grid-template-areas:
"image header"
"hotel hotel"
"prices prices";
gap: var(--Spacing-x2);
padding: var(--Spacing-x2);
background-color: var(--Base-Surface-Primary-light-Normal);
border: 1px solid var(--Base-Border-Subtle);
border-radius: var(--Corner-radius-Small);
overflow: hidden;
height: 460px;
width: 480px;
border-radius: var(--Corner-radius-Medium);
width: 100%;
max-width: 307px;
}
.header {
grid-area: header;
}
.image {
height: auto;
max-height: 180px;
height: 100%;
max-height: 95px;
width: 116px;
object-fit: cover;
width: 100%;
grid-area: image;
}
.information {
.logo {
margin-bottom: var(--Spacing-x-half);
}
.hotel {
display: flex;
flex-direction: column;
gap: var(--Spacing-x1);
grid-area: hotel;
}
.facilities {
display: flex;
flex-wrap: wrap;
gap: var(--Spacing-x-half);
}
.link {
display: flex;
padding: var(--Spacing-x1) var(--Spacing-x0);
border-bottom: 1px solid var(--Base-Border-Subtle);
}
.prices {
display: flex;
flex-direction: column;
gap: var(--Spacing-x2);
padding: var(--Spacing-x2);
grid-area: prices;
}
.title {
display: flex;
flex-direction: column;
gap: var(--Spacing-x1);
}
.description {
display: flex;
flex-direction: column;
gap: var(--Spacing-x1);
font-family: var(--typography-Caption-Regular-fontFamily);
font-size: var(--typography-Caption-Regular-fontSize);
}
.chips {
display: flex;
flex-wrap: wrap;
gap: var(--Spacing-x1);
}
.booking {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--Spacing-x1);
.public,
.member {
max-width: fit-content;
margin-bottom: var(--Spacing-x-half);
}
.button {
width: 100%;
justify-content: center;
display: none;
}
@media screen and (min-width: 1367px) {
.card {
grid-template-columns: 1fr min(480px);
height: 285px;
width: 850px;
grid-template-areas:
"image header"
"image hotel"
"image prices";
grid-template-columns: auto-fill;
overflow: hidden;
width: 100%;
max-width: 1050px;
padding: 0;
}
.image {
min-height: 285px;
max-height: 100%;
width: 100%;
max-width: 518px;
}
.booking {
justify-content: space-between;
flex-direction: row-reverse;
.header {
padding-top: var(--Spacing-x2);
padding-right: var(--Spacing-x2);
}
.hotel {
padding-right: var(--Spacing-x2);
}
.prices {
flex-direction: row;
padding-right: var(--Spacing-x2);
padding-bottom: var(--Spacing-x2);
}
.link {
border-bottom: none;
}
.button {
width: auto;
display: flex;
width: 160px;
justify-content: center;
}
}

View File

@@ -1,7 +1,16 @@
import { ScandicLogoIcon } from "@/components/Icons"
import {
ChevronRightIcon,
PriceTagIcon,
ScandicLogoIcon,
} from "@/components/Icons"
import { getIconByIconName } from "@/components/Icons/get-icon-by-icon-name"
import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button"
import Chip from "@/components/TempDesignSystem/Chip"
import Divider from "@/components/TempDesignSystem/Divider"
import Link from "@/components/TempDesignSystem/Link"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
@@ -10,7 +19,7 @@ import styles from "./hotelCard.module.css"
import { HotelCardProps } from "@/types/components/hotelReservation/selectHotel/hotelCardProps"
export default async function HotelCard({ hotel }: HotelCardProps) {
const { formatMessage } = await getIntl()
const intl = await getIntl()
return (
<article className={styles.card}>
<Image
@@ -20,33 +29,53 @@ export default async function HotelCard({ hotel }: HotelCardProps) {
height={200}
className={styles.image}
/>
<div className={styles.information}>
<header className={styles.title}>
<ScandicLogoIcon color="red" />
<Title as="h4" textTransform="capitalize">
{hotel.name}
</Title>
</header>
<div className={styles.description}>
<span>{`${hotel.address.streetAddress}, ${hotel.address.city}`}</span>
<span>{hotel.hotelContent.texts.descriptions.short}</span>
</div>
<div className={styles.chips}>
{hotel.detailedFacilities.slice(0, 6).map((chip, index) => (
<Chip key={`chip-${index}`}>{chip.name}</Chip>
<header className={styles.header}>
<ScandicLogoIcon color="red" className={styles.logo} />
<Title as="h4" textTransform="capitalize">
{hotel.name}
</Title>
<Footnote color="textMediumContrast">{`${hotel.address.streetAddress}, ${hotel.address.city}`}</Footnote>
<Footnote color="textMediumContrast">{`${hotel.location.distanceToCentre} ${intl.formatMessage({ id: "km to city center" })}`}</Footnote>
</header>
<section className={styles.hotel}>
<div className={styles.facilities}>
{hotel.detailedFacilities.slice(0, 6).map((data) => (
<Caption key={data.id} color="textMediumContrast">
{data.name}
</Caption>
))}
</div>
<footer className={styles.booking}>
<Button
theme="base"
intent="primary"
size="small"
className={styles.button}
>
{formatMessage({ id: "Book" })}
</Button>
</footer>
</div>
<Link href="#" color="burgundy" className={styles.link}>
{intl.formatMessage({ id: "See hotel details" })}
<ChevronRightIcon color="burgundy" />
</Link>
</section>
<section className={styles.prices}>
<div>
<Chip intent="sublte" className={styles.public}>
<PriceTagIcon width={15} height={15} />
{intl.formatMessage({ id: "Public price from" })}
</Chip>
<Caption color="textMediumContrast">2820 SEK / night</Caption>
<Footnote color="textMediumContrast">approx 280 eur</Footnote>
</div>
<div>
<Chip intent="pale" className={styles.member}>
<PriceTagIcon width={15} height={15} />
{intl.formatMessage({ id: "Member price from" })}
</Chip>
<Caption color="textMediumContrast">2820 SEK / night</Caption>
<Footnote color="textMediumContrast">approx 280 eur</Footnote>
</div>
<Button
theme="base"
intent="tertiary"
size="small"
className={styles.button}
>
{intl.formatMessage({ id: "See rooms" })}
</Button>
</section>
</article>
)
}