fix(BOOK-210): add local charges for Finland and update design for hotel card * fix(BOOK-210): add local charges for Finland and update design for hotel card * feat(BOOK-210): change variant to conditional classname * fix(BOOK-210): update link with icon * fix(BOOK-210): update buttonlink tripadvisor * fix(BOOK-210): switch wrapper logic * fix(BOOK-210): update variants tripadvisor Approved-by: Erik Tiekstra
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import Image from '../../Image'
|
|
|
|
import { TripAdvisorChip } from '../../TripAdvisorChip'
|
|
import { hotelCardDialogImageVariants } from './variants'
|
|
|
|
import ImageFallback from '../../ImageFallback'
|
|
|
|
export type HotelCardDialogImageProps = {
|
|
imageSrc?: string
|
|
altText?: string
|
|
rating?: { tripAdvisor?: number | null }
|
|
imageError: boolean
|
|
setImageError: (error: boolean) => void
|
|
position: 'top' | 'left'
|
|
}
|
|
|
|
export function HotelCardDialogImage({
|
|
imageSrc,
|
|
altText,
|
|
rating,
|
|
imageError,
|
|
setImageError,
|
|
position,
|
|
}: HotelCardDialogImageProps) {
|
|
const classNames = hotelCardDialogImageVariants({ position })
|
|
|
|
return (
|
|
<div className={classNames}>
|
|
{!imageSrc || imageError ? (
|
|
<ImageFallback />
|
|
) : (
|
|
<Image
|
|
src={imageSrc}
|
|
alt={altText || ''}
|
|
fill
|
|
onError={() => setImageError(true)}
|
|
/>
|
|
)}
|
|
{rating?.tripAdvisor && (
|
|
<TripAdvisorChip
|
|
rating={rating.tripAdvisor}
|
|
size={position === 'top' ? 'small' : 'default'}
|
|
/>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|