Files
web/packages/design-system/lib/components/HotelCard/HotelCardDialogImage/index.tsx
Joakim Jäderberg c54c1ec540 Merged in SW-3270-move-interactive-map-to-design-system-or-booking-flow (pull request #2681)
SW-3270 move interactive map to design system or booking flow

* wip

* wip

* merge

* wip

* add support for locales in design-system

* add story for HotelCard

* setup alias

* .

* remove tracking from design-system for hotelcard

* pass isUserLoggedIn

* export design-system-new-deprecated.css from design-system

* Add HotelMarkerByType to Storybook

* Add interactive map to Storybook

* fix reactintl in vitest

* rename env variables

* .

* fix background colors

* add storybook stories for <Link />

* merge

* fix tracking for when clicking 'See rooms' in InteractiveMap

* Merge branch 'master' of bitbucket.org:scandic-swap/web into SW-3270-move-interactive-map-to-design-system-or-booking-flow

* remove deprecated comment


Approved-by: Anton Gunnarsson
2025-08-25 11:26:16 +00:00

52 lines
1.3 KiB
TypeScript

import TripadvisorIcon from '@scandic-hotels/design-system/Icons/TripadvisorIcon'
import Image from '@scandic-hotels/design-system/Image'
import Chip from '@scandic-hotels/design-system/Chip'
import { hotelCardDialogImageVariants } from './variants'
import styles from './hotelCardDialogImage.module.css'
export type HotelCardDialogImageProps = {
firstImage?: string
altText?: string
rating?: { tripAdvisor?: number | null }
imageError: boolean
setImageError: (error: boolean) => void
position: 'top' | 'left'
}
export function HotelCardDialogImage({
firstImage,
altText,
rating,
imageError,
setImageError,
position,
}: HotelCardDialogImageProps) {
const classNames = hotelCardDialogImageVariants({ position })
return (
<div className={classNames}>
{!firstImage || imageError ? (
<div className={styles.imagePlaceholder} />
) : (
<Image
src={firstImage}
alt={altText || ''}
fill
onError={() => setImageError(true)}
/>
)}
{rating?.tripAdvisor && (
<div className={styles.tripAdvisor}>
<Chip className={styles.tripAdvisor}>
<TripadvisorIcon color="Icon/Interactive/Default" />
{rating.tripAdvisor}
</Chip>
</div>
)}
</div>
)
}