fix(SW-1608): Hotel listing synced with design

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-05-26 11:49:51 +00:00
parent a790a52067
commit a8e52c6c8a
4 changed files with 70 additions and 63 deletions

View File

@@ -1,35 +1,38 @@
.container {
background-color: var(--Base-Surface-Primary-light-Normal);
border: 1px solid var(--Base-Border-Subtle);
background-color: var(--Surface-Primary-Default);
border: 1px solid var(--Border-Default);
border-radius: var(--Corner-radius-md);
overflow: hidden;
color: var(--Text-Default);
}
.image {
width: 100%;
max-height: 200px;
height: 200px;
object-fit: cover;
}
.content {
display: flex;
flex-direction: column;
gap: var(--Spacing-x2);
padding: var(--Spacing-x2) var(--Spacing-x3);
display: grid;
gap: var(--Space-x2);
padding: var(--Space-x2) var(--Space-x3);
}
.intro {
display: flex;
flex-direction: column;
gap: var(--Spacing-x-half);
}
.dividerContainer {
padding: 0 var(--Spacing-x1);
display: grid;
gap: var(--Space-x05);
}
.captions {
display: flex;
gap: var(--Space-x1);
color: var(--Text-Tertiary);
}
@media screen and (max-width: 767px) {
.ctaDivider {
display: none;
}
}
@media screen and (min-width: 768px) {
@@ -39,11 +42,11 @@
}
.image {
max-height: none;
height: 100%;
}
.button {
width: min(100%, 200px);
justify-self: end;
}
}

View File

@@ -1,13 +1,9 @@
import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import ButtonLink from "@/components/ButtonLink"
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 Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getSingleDecimal } from "@/utils/numberFormatting"
@@ -37,56 +33,58 @@ export default async function HotelListingItem({
<Image
src={image.src}
alt={image.alt}
width={300}
height={200}
width={400}
height={300}
sizes="(min-width: 768px) 400px, 100vw"
className={styles.image}
/>
<section className={styles.content}>
<div className={styles.intro}>
<HotelLogoIcon hotelId={hotel.operaId} hotelType={hotel.hotelType} />
<Subtitle asChild>
<Title as="h3">{hotel.name}</Title>
</Subtitle>
<div className={styles.captions}>
<Caption color="uiTextPlaceholder">
{hotel.address.streetAddress}
</Caption>
<div className={styles.dividerContainer}>
<Divider variant="vertical" color="beige" />
<Typography variant="Title/Subtitle/lg">
<h4>{hotel.name}</h4>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<div className={styles.captions}>
<span>{hotel.address.streetAddress}</span>
<Divider variant="vertical" color="Border/Divider/Default" />
<span>
{intl.formatMessage(
{
defaultMessage: "{number} km to city center",
},
{
number: getSingleDecimal(
hotel.location.distanceToCentre / 1000
),
}
)}
</span>
</div>
<Caption color="uiTextPlaceholder">
{intl.formatMessage(
{
defaultMessage: "{number} km to city center",
},
{
number: getSingleDecimal(
hotel.location.distanceToCentre / 1000
),
}
)}
</Caption>
</div>
</Typography>
</div>
<Body>{description}</Body>
<Typography variant="Body/Paragraph/mdRegular">
<p>{description}</p>
</Typography>
{cta.url && (
<Button
intent="primary"
theme="base"
size="small"
className={styles.button}
asChild
>
<Link
{cta.url ? (
<>
<Divider
className={styles.ctaDivider}
variant="horizontal"
color="borderDividerSubtle"
/>
<ButtonLink
variant="Primary"
size="Small"
href={cta.url}
color="white"
target={cta.openInNewTab ? "_blank" : "_self"}
className={styles.button}
>
{cta.text}
</Link>
</Button>
)}
</ButtonLink>
</>
) : null}
</section>
</article>
)

View File

@@ -0,0 +1,3 @@
.heading {
color: var(--Text-Heading);
}

View File

@@ -1,10 +1,13 @@
import { Typography } from "@scandic-hotels/design-system/Typography"
import { getHotelsByCSFilter } from "@/lib/trpc/memoizedRequests"
import SectionContainer from "@/components/Section/Container"
import Title from "@/components/TempDesignSystem/Text/Title"
import HotelListingItem from "./HotelListingItem"
import styles from "./hotelListing.module.css"
import type { HotelListingProps } from "@/types/components/blocks/hotelListing"
export default async function HotelListing({
@@ -24,9 +27,9 @@ export default async function HotelListing({
return (
<SectionContainer>
<Title level="h4" as="h3" textTransform="capitalize">
{heading}
</Title>
<Typography variant="Title/sm">
<h3 className={styles.heading}>{heading}</h3>
</Typography>
{hotels.map(({ url, hotel, additionalData }) => (
<HotelListingItem
key={hotel.name}