feat(SW-3228): Move Image to design-system * Move Image to design-system * Merge branch 'master' into feat/sw-3228-move-image-to-design-system Approved-by: Linus Flood
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import TripadvisorIcon from "@scandic-hotels/design-system/Icons/TripadvisorIcon"
|
|
import Image from "@scandic-hotels/design-system/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>
|
|
)
|
|
}
|