import {PlaceCategory} from '@o2o/shared'; import {HeroCatchphrase} from '@site/sections/HeroCatchphrase'; import {useSite} from '@site/lib/site-context'; import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView} from '@site/lib/derive'; import {heroSub} from '../kit/heroSub'; import {Car} from '../paper/Car'; import {BOOK_EVENT} from '../paper/Rooms'; import {Weather} from './Weather'; const MAX_SLIDES = 5; export function Hero() { const payload = useSite(); const {place, narrative} = payload; const slides = [...payload.media] .filter((image) => image.alt?.trim()) .sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary)) .slice(0, MAX_SLIDES); const fixed = narrative.tagline ?? narrative.heroSubline; const lodging = place.category === PlaceCategory.LODGING; const sub = heroSub(payload); const region = place.addressLocality ?? place.addressRegion; const booking = bookingLinks(payload)[0]; const stay = lodging ? stayBookingView(payload) : null; return ( <>
{fixed}
)} {lodging && sub &&{sub}
}