feat(SW-252): add icons

This commit is contained in:
Fredrik Thorsson
2024-08-26 14:02:23 +02:00
parent 69ebf254d1
commit bb820afd0e
2 changed files with 24 additions and 14 deletions

View File

@@ -9,8 +9,7 @@
background-color: var(--Base-Surface-Primary-light-Normal); background-color: var(--Base-Surface-Primary-light-Normal);
border: 1px solid var(--Base-Border-Subtle); border: 1px solid var(--Base-Border-Subtle);
border-radius: var(--Corner-radius-Medium); border-radius: var(--Corner-radius-Medium);
width: 100%; width: 307px;
max-width: 307px;
} }
.header { .header {
@@ -39,6 +38,12 @@
.facilities { .facilities {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: var(--Spacing-x1);
}
.facilitiesItem {
display: flex;
align-items: center;
gap: var(--Spacing-x-half); gap: var(--Spacing-x-half);
} }
@@ -71,17 +76,14 @@
"image header" "image header"
"image hotel" "image hotel"
"image prices"; "image prices";
grid-template-columns: auto-fill;
overflow: hidden; overflow: hidden;
width: 100%; width: 1050px;
max-width: 1050px;
padding: 0; padding: 0;
} }
.image { .image {
max-height: 100%; max-height: 100%;
width: 100%; width: 518px;
max-width: 518px;
} }
.header { .header {

View File

@@ -1,13 +1,12 @@
import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
import { import {
ChevronRightIcon, ChevronRightIcon,
PriceTagIcon, PriceTagIcon,
ScandicLogoIcon, ScandicLogoIcon,
} from "@/components/Icons" } from "@/components/Icons"
import { getIconByIconName } from "@/components/Icons/get-icon-by-icon-name"
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"
import Divider from "@/components/TempDesignSystem/Divider"
import Link from "@/components/TempDesignSystem/Link" import Link from "@/components/TempDesignSystem/Link"
import Caption from "@/components/TempDesignSystem/Text/Caption" import Caption from "@/components/TempDesignSystem/Text/Caption"
import Footnote from "@/components/TempDesignSystem/Text/Footnote" import Footnote from "@/components/TempDesignSystem/Text/Footnote"
@@ -20,6 +19,11 @@ import { HotelCardProps } from "@/types/components/hotelReservation/selectHotel/
export default async function HotelCard({ hotel }: HotelCardProps) { export default async function HotelCard({ hotel }: HotelCardProps) {
const intl = await getIntl() const intl = await getIntl()
const sortedAmenities = hotel.detailedFacilities
.sort((a, b) => b.sortOrder - a.sortOrder)
.slice(0, 5)
return ( return (
<article className={styles.card}> <article className={styles.card}>
<Image <Image
@@ -39,11 +43,15 @@ export default async function HotelCard({ hotel }: HotelCardProps) {
</header> </header>
<section className={styles.hotel}> <section className={styles.hotel}>
<div className={styles.facilities}> <div className={styles.facilities}>
{hotel.detailedFacilities.slice(0, 6).map((data) => ( {sortedAmenities.map((facility) => {
<Caption key={data.id} color="textMediumContrast"> const IconComponent = mapFacilityToIcon(facility.name)
{data.name} return (
</Caption> <div className={styles.facilitiesItem} key={facility.id}>
))} {IconComponent && <IconComponent color="grey80" />}
<Caption color="textMediumContrast">{facility.name}</Caption>
</div>
)
})}
</div> </div>
<Link href="#" color="burgundy" className={styles.link}> <Link href="#" color="burgundy" className={styles.link}>
{intl.formatMessage({ id: "See hotel details" })} {intl.formatMessage({ id: "See hotel details" })}