feat(SW-281): refactor

This commit is contained in:
Fredrik Thorsson
2024-10-24 15:08:23 +02:00
parent 2428e09fe5
commit b841604e5e
5 changed files with 75 additions and 70 deletions

View File

@@ -0,0 +1,49 @@
.container {
background-color: var(--Base-Surface-Primary-light-Normal);
border: 1px solid var(--Base-Border-Subtle);
border-radius: var(--Corner-radius-Medium);
overflow: hidden;
}
.image {
width: 100%;
object-fit: cover;
}
.content {
display: flex;
flex-direction: column;
gap: var(--Spacing-x2);
padding: var(--Spacing-x2) var(--Spacing-x3);
}
.intro {
display: flex;
flex-direction: column;
gap: var(--Spacing-x-half);
}
.dividerContainer {
padding: 0 var(--Spacing-x1);
}
.captions {
display: flex;
flex-direction: row;
}
@media screen and (min-width: 768px) {
.container {
display: grid;
grid-template-columns: 1fr 2fr;
}
.image {
height: 100%;
}
.button {
width: 100%;
max-width: 200px;
}
}

View File

@@ -0,0 +1,66 @@
import { ScandicLogoIcon } from "@/components/Icons"
import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button"
import Divider from "@/components/TempDesignSystem/Divider"
import Link from "@/components/TempDesignSystem/Link"
import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import { getIntl } from "@/i18n"
import styles from "./hotelListing.module.css"
import { HotelListingProps } from "@/types/components/contentPage/hotelListing"
export default async function HotelListing({
image,
name,
address,
distance,
description,
}: HotelListingProps) {
const intl = await getIntl()
return (
<li>
<article className={styles.container}>
<section>
<Image
src={image}
alt=""
width={300}
height={200}
className={styles.image}
/>
</section>
<section className={styles.content}>
<div className={styles.intro}>
<ScandicLogoIcon color="red" />
<Subtitle>{name}</Subtitle>
<div className={styles.captions}>
<Caption color="uiTextPlaceholder">{address}</Caption>
<div className={styles.dividerContainer}>
<Divider variant="vertical" color="beige" />
</div>
<Caption color="uiTextPlaceholder">
{`${distance} ${intl.formatMessage({ id: "km to city center" })}`}
</Caption>
</div>
</div>
<Body>{description}</Body>
<Button
intent="primary"
theme="base"
size="small"
className={styles.button}
asChild
>
<Link href="#" color="white">
{intl.formatMessage({ id: "See hotel details" })}
</Link>
</Button>
</section>
</article>
</li>
)
}