Files
web/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/index.tsx
Joakim Jäderberg aafad9781f Merged in feat/lokalise-rebuild (pull request #2993)
Feat/lokalise rebuild

* chore(lokalise): update translation ids

* chore(lokalise): easier to switch between projects

* chore(lokalise): update translation ids

* .

* .

* .

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* chore(lokalise): new translations

* merge

* switch to errors for missing id's

* merge

* sync translations


Approved-by: Linus Flood
2025-10-22 11:00:03 +00:00

102 lines
3.1 KiB
TypeScript

import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting"
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
import { Divider } from "@scandic-hotels/design-system/Divider"
import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon"
import Image from "@scandic-hotels/design-system/Image"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { getIntl } from "@/i18n"
import styles from "./hotelListingItem.module.css"
import type { HotelListingItemProps } from "@/types/components/contentPage/hotelListingItem"
export default async function HotelListingItem({
hotelData,
contentType = "hotel",
}: HotelListingItemProps) {
const intl = await getIntl()
const { galleryImages, description, id, name, hotelType, location, address } =
hotelData.hotel
const image = galleryImages[0]
const cta =
contentType === "meeting" && hotelData.meetingUrl
? {
url: hotelData.meetingUrl,
openInNewTab: true,
text: intl.formatMessage({
id: "meetingPackage.bookAMeeting",
defaultMessage: "Book a meeting",
}),
}
: {
url: hotelData.url,
openInNewTab: false,
text: intl.formatMessage({
id: "destination.seeHotelDetails",
defaultMessage: "See hotel details",
}),
}
return (
<article className={styles.container}>
<Image
src={image.src}
alt={image.altText || image.altText_En}
width={400}
height={300}
sizes="(min-width: 768px) 400px, 100vw"
className={styles.image}
/>
<section className={styles.content}>
<div className={styles.intro}>
<HotelLogoIcon hotelId={id} hotelType={hotelType} />
<Typography variant="Title/Subtitle/lg">
<h4>{name}</h4>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<div className={styles.captions}>
<span>{address.streetAddress}</span>
<Divider variant="vertical" />
<span>
{intl.formatMessage(
{
id: "common.kmToCityCenter",
defaultMessage: "{number} km to city center",
},
{
number: getSingleDecimal(location.distanceToCentre / 1000),
}
)}
</span>
</div>
</Typography>
</div>
<Typography variant="Body/Paragraph/mdRegular">
<p>{description}</p>
</Typography>
{cta.url ? (
<>
<Divider
className={styles.ctaDivider}
color="Border/Divider/Subtle"
/>
<ButtonLink
variant="Primary"
size="Small"
href={cta.url}
target={cta.openInNewTab ? "_blank" : undefined}
className={styles.button}
>
{cta.text}
</ButtonLink>
</>
) : null}
</section>
</article>
)
}