feat(SW-252): wrap image for layout

This commit is contained in:
Fredrik Thorsson
2024-08-27 09:38:01 +02:00
parent bb820afd0e
commit 8c4ade719f
4 changed files with 55 additions and 37 deletions

View File

@@ -12,26 +12,27 @@
width: 307px; width: 307px;
} }
.header { .imageContainer {
grid-area: header; grid-area: image;
}
.tripAdvisor {
display: none;
} }
.image { .image {
height: 100%; height: 100%;
max-height: 95px;
width: 116px; width: 116px;
object-fit: cover; object-fit: cover;
grid-area: image;
} }
.logo { .header {
margin-bottom: var(--Spacing-x-half); grid-area: header;
} }
.hotel { .hotel {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--Spacing-x1);
grid-area: hotel; grid-area: hotel;
} }
@@ -49,7 +50,7 @@
.link { .link {
display: flex; display: flex;
padding: var(--Spacing-x1) var(--Spacing-x0); padding: var(--Spacing-x2) var(--Spacing-x0);
border-bottom: 1px solid var(--Base-Border-Subtle); border-bottom: 1px solid var(--Base-Border-Subtle);
} }
@@ -67,7 +68,7 @@
} }
.button { .button {
display: none; justify-content: center;
} }
@media screen and (min-width: 1367px) { @media screen and (min-width: 1367px) {
@@ -81,8 +82,18 @@
padding: 0; padding: 0;
} }
.imageContainer {
position: relative;
}
.tripAdvisor {
display: block;
position: absolute;
left: 7px;
top: 7px;
}
.image { .image {
max-height: 100%;
width: 518px; width: 518px;
} }
@@ -92,11 +103,14 @@
} }
.hotel { .hotel {
gap: var(--Spacing-x2);
padding-right: var(--Spacing-x2); padding-right: var(--Spacing-x2);
} }
.prices { .prices {
flex-direction: row; flex-direction: row;
align-items: center;
justify-content: space-between;
padding-right: var(--Spacing-x2); padding-right: var(--Spacing-x2);
padding-bottom: var(--Spacing-x2); padding-bottom: var(--Spacing-x2);
} }
@@ -106,8 +120,6 @@
} }
.button { .button {
display: flex;
width: 160px; width: 160px;
justify-content: center;
} }
} }

View File

@@ -4,6 +4,7 @@ import {
PriceTagIcon, PriceTagIcon,
ScandicLogoIcon, ScandicLogoIcon,
} from "@/components/Icons" } from "@/components/Icons"
import TripAdvisorIcon from "@/components/Icons/TripAdvisor"
import Image from "@/components/Image" import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import Chip from "@/components/TempDesignSystem/Chip" import Chip from "@/components/TempDesignSystem/Chip"
@@ -26,20 +27,32 @@ export default async function HotelCard({ hotel }: HotelCardProps) {
return ( return (
<article className={styles.card}> <article className={styles.card}>
<Image <div className={styles.imageContainer}>
src={hotel.hotelContent.images.imageSizes.large} <Image
alt={hotel.hotelContent.images.metaData.altText} src={hotel.hotelContent.images.imageSizes.large}
width={300} alt={hotel.hotelContent.images.metaData.altText}
height={200} width={300}
className={styles.image} height={200}
/> className={styles.image}
/>
<div className={styles.tripAdvisor}>
<Chip intent="primary" className={styles.tripAdvisor}>
<TripAdvisorIcon color="white" />
{hotel.ratings?.tripAdvisor.rating}
</Chip>
</div>
</div>
<header className={styles.header}> <header className={styles.header}>
<ScandicLogoIcon color="red" className={styles.logo} /> <ScandicLogoIcon color="red" />
<Title as="h4" textTransform="capitalize"> <Title as="h4" textTransform="capitalize">
{hotel.name} {hotel.name}
</Title> </Title>
<Footnote color="textMediumContrast">{`${hotel.address.streetAddress}, ${hotel.address.city}`}</Footnote> <Footnote color="textMediumContrast" className={styles.adress}>
<Footnote color="textMediumContrast">{`${hotel.location.distanceToCentre} ${intl.formatMessage({ id: "km to city center" })}`}</Footnote> {`${hotel.address.streetAddress}, ${hotel.address.city}`}
</Footnote>
<Footnote color="textMediumContrast">
{`${hotel.location.distanceToCentre} ${intl.formatMessage({ id: "km to city center" })}`}
</Footnote>
</header> </header>
<section className={styles.hotel}> <section className={styles.hotel}>
<div className={styles.facilities}> <div className={styles.facilities}>
@@ -60,28 +73,31 @@ export default async function HotelCard({ hotel }: HotelCardProps) {
</section> </section>
<section className={styles.prices}> <section className={styles.prices}>
<div> <div>
<Chip intent="sublte" className={styles.public}> <Chip intent="primary" className={styles.public}>
<PriceTagIcon width={15} height={15} /> <PriceTagIcon color="white" width={15} height={15} />
{intl.formatMessage({ id: "Public price from" })} {intl.formatMessage({ id: "Public price from" })}
</Chip> </Chip>
<Caption color="textMediumContrast">2820 SEK / night</Caption> <Caption color="textMediumContrast">2820 SEK / night</Caption>
<Footnote color="textMediumContrast">approx 280 eur</Footnote> <Footnote color="textMediumContrast">approx 280 eur</Footnote>
</div> </div>
<div> <div>
<Chip intent="pale" className={styles.member}> <Chip intent="primary" className={styles.member}>
<PriceTagIcon width={15} height={15} /> <PriceTagIcon color="white" width={15} height={15} />
{intl.formatMessage({ id: "Member price from" })} {intl.formatMessage({ id: "Member price from" })}
</Chip> </Chip>
<Caption color="textMediumContrast">2820 SEK / night</Caption> <Caption color="textMediumContrast">2820 SEK / night</Caption>
<Footnote color="textMediumContrast">approx 280 eur</Footnote> <Footnote color="textMediumContrast">approx 280 eur</Footnote>
</div> </div>
<Button <Button
asChild
theme="base" theme="base"
intent="tertiary" intent="tertiary"
size="small" size="small"
className={styles.button} className={styles.button}
> >
{intl.formatMessage({ id: "See rooms" })} <Link href="#" color="none">
{intl.formatMessage({ id: "See rooms" })}
</Link>
</Button> </Button>
</section> </section>
</article> </article>

View File

@@ -12,11 +12,3 @@ div.chip {
background-color: var(--Scandic-Red-90); background-color: var(--Scandic-Red-90);
color: var(--Primary-Dark-On-Surface-Accent); color: var(--Primary-Dark-On-Surface-Accent);
} }
.subtle {
background-color: var(--Base-Surface-Subtle-Normal);
}
.pale {
background-color: var(--Scandic-Brand-Pale-Peach);
}

View File

@@ -6,8 +6,6 @@ export const chipVariants = cva(styles.chip, {
variants: { variants: {
intent: { intent: {
primary: styles.primary, primary: styles.primary,
sublte: styles.subtle,
pale: styles.pale,
}, },
variant: { variant: {
default: styles.default, default: styles.default,