Files
web/packages/design-system/lib/components/HotelCard/HotelCardDialogImage/index.tsx
Bianca Widstam 5f8d77e54a Merged in fix/SW-1655-tripadvisor-icon-map (pull request #2695)
fix(SW-1655): update design tripadvisor on hotel map card

* fix(SW-1655): update design tripadvisor on hotel map card

* fix(SW-1655): update radius

* fix(SW-1655): use tripadvisor chip, create different variants

* fix(SW-1655): update variants, storybook, and global css


Approved-by: Joakim Jäderberg
2025-08-26 13:08:28 +00:00

48 lines
1.1 KiB
TypeScript

import Image from '@scandic-hotels/design-system/Image'
import { hotelCardDialogImageVariants } from './variants'
import { TripAdvisorChip } from '@scandic-hotels/design-system/TripAdvisorChip'
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 && (
<TripAdvisorChip
rating={rating.tripAdvisor}
variant={position === 'top' ? 'small' : 'default'}
/>
)}
</div>
)
}