const { Button, Tag, Select, Pagination, Skeleton, DestinationCard, PackageCard, TripSearch, Breadcrumbs, Icon, Badge } = window.VE; const STYLES = ['Beach', 'Mountains', 'Culture', 'Honeymoon', 'Family', 'Luxury']; function DestinationListingScreen({ onOpen, search, onSearchChange, onSearchSubmit, isMobile }) { const [active, setActive] = React.useState([]); const [sort, setSort] = React.useState('recommended'); const [page, setPage] = React.useState(1); const [loading, setLoading] = React.useState(false); const D = window.VE_DATA; const toggle = (s) => { setActive((prev) => (prev.includes(s) ? prev.filter((x) => x !== s) : prev.concat(s))); setLoading(true); window.setTimeout(() => setLoading(false), 450); }; let list = D.destinations.filter((d) => !active.length || active.some((s) => d.style.includes(s))); if (sort === 'price-low') list = list.slice().sort((a, b) => a.priceFrom - b.priceFrom); if (sort === 'price-high') list = list.slice().sort((a, b) => b.priceFrom - a.priceFrom); return (
{isMobile ? : onSearchChange({ ...search, activeField: field })} onSubmit={onSearchSubmit} submitLabel="Search" />}
{STYLES.map((s) => toggle(s)}>{s})} {active.length ? : null}