Files
web/apps/scandic-web/components/HotelReservation/HotelCardDialog/HotelCardDialogImage/index.tsx
Matilda Landström 76cf33a199 Merged in fix/tripadvisor-rating (pull request #2193)
fix(SW-2892): don't show Tripadvisor rating if undefined

* fix: don't show rating if undefined


Approved-by: Bianca Widstam
Approved-by: Christian Andolf
Approved-by: Erik Tiekstra
2025-05-22 15:05:25 +00:00

45 lines
1.1 KiB
TypeScript

import TripadvisorIcon from "@scandic-hotels/design-system/Icons/TripadvisorIcon"
import Image from "@/components/Image"
import Chip from "@/components/TempDesignSystem/Chip"
import { hotelCardDialogImageVariants } from "./variants"
import styles from "./hotelCardDialogImage.module.css"
import type { HotelCardDialogImageProps } from "@/types/components/hotelReservation/selectHotel/map"
export default 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 ? (
<div className={styles.tripAdvisor}>
<Chip className={styles.tripAdvisor}>
<TripadvisorIcon color="Icon/Interactive/Default" />
{rating}
</Chip>
</div>
) : null}
</div>
)
}