import {PlaceCategory} from '@o2o/shared'; import {HeroCatchphrase} from '@site/sections/HeroCatchphrase'; import {useSite} from '@site/lib/site-context'; import {bookingActionLabel, bookingLinks, heroFacts, isSectionEnabled, stayBookingView} from '@site/lib/derive'; 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 region = place.addressLocality ?? place.addressRegion; const booking = bookingLinks(payload)[0]; const stay = lodging ? stayBookingView(payload) : null; const chips = heroFacts(payload).map((row) => `${row.label} ${row.value}`); return ( <>
{fixed}
)} {lodging && fixed &&{fixed}
} {chips.length > 0 && (