/* global React */ // Explore Suffolk const { useState, useEffect } = React; const NS_E = window.GamekeepersCottageDesignSystem_070bc7; const { Eyebrow, Button, Card, Badge } = NS_E; const Photo = window.GKPhoto; const IMG = window.GK_IMG; // Filter categories are built dynamically from the places data (see ExploreContent). // Places — read from assets/attractions.json (Decap-managed) on the live host; // fall back to the embedded snapshot for local file:// previews. let _attrCache = null, _attrPromise = null; function loadAttractions() { if (_attrCache) return Promise.resolve(_attrCache); if (_attrPromise) return _attrPromise; _attrPromise = (async () => { try { const res = await fetch('assets/attractions.json', { cache: 'no-store' }); if (res.ok) { const d = await res.json(); if (d && Array.isArray(d.places)) { _attrCache = d.places; return _attrCache; } } } catch (e) { /* fall through */ } if (window.GK_ATTRACTIONS && Array.isArray(window.GK_ATTRACTIONS.places)) { _attrCache = window.GK_ATTRACTIONS.places; return _attrCache; } _attrCache = []; return _attrCache; })(); return _attrPromise; } function useAttractions() { const [list, setList] = useState(_attrCache || []); useEffect(() => { let live = true; loadAttractions().then(a => { if (live) setList(a); }); return () => { live = false; }; }, []); return list; } function ExploreContent() { const [filter, setFilter] = useState(() => new URLSearchParams(window.location.search).get('filter') || 'All'); const places = useAttractions(); const categories = ['All', ...places.reduce((acc, p) => { if (p.category && acc.indexOf(p.category) === -1) acc.push(p.category); return acc; }, [])]; const list = places.filter(p => filter === 'All' || p.category === filter); // Arriving with a category from the nav dropdown? Jump to the filtered cards. useEffect(() => { if (filter !== 'All') { const el = document.getElementById('attractions'); if (el) setTimeout(() => el.scrollIntoView({ behavior: 'smooth', block: 'start' }), 120); } }, []); return (
Explore Suffolk

Discover wonderful things to do in Suffolk

Make the most of your stay. These are our own recommended picks of local attractions, pubs, beaches and walks — all within easy reach of the cottage.

Filter {categories.map(f => ( ))}
{list.map((p) => ( {p.photos && p.photos.length > 0 ? : }
{p.category}

{p.title}

{p.excerpt}

{p.location}
))}
); } window.GKmount('explore', ExploreContent);