/* global React */ // Reviews const { useState } = React; const NS_R = window.GamekeepersCottageDesignSystem_070bc7; const { Eyebrow, Button, Card, Rating } = NS_R; const useShell = window.GKuseShell; const useReviews = window.GKuseReviews; const reviewMonth = window.GKreviewMonth; const reviewStats = window.GKreviewStats; const REVIEWS = [ ['A winter woodland paradise', 'One of the loveliest places we have ever stayed — cosy and characterful, with a stunning garden and an abundance of woodland wildlife. We had the entire place to ourselves, apart from the many birds at the feeders. We will definitely be back.', 'JP', 'January 2026'], ['Idyllic', 'Such a beautiful, secluded location. A week of sunny weather made it ideal for sitting out and listening to nature, a BBQ and the occasional glass of wine. We all loved it — just how life should be.', 'Mark Rawlinson', 'September 2025'], ['Perfect setting for Easter week in Suffolk', 'We saw deer, buzzard and woodpeckers in the wood, with plenty of birds on the feeders. Just stopping to listen to the sounds of nature was wonderful. I couldn’t recommend it more.', 'William Ripper', 'April 2025'], ['A real home from home', 'You can tell the owners care. Everything you need is here and the welcome was warm. The log burner made our evenings, and the woodland walks were magical with the children.', 'The Hendersons', 'February 2025'], ['Birdsong and total peace', 'We came to switch off and that is exactly what we got. No traffic, no light pollution — just birdsong and the wood. The cottage is spotless and full of character.', 'Sue & David', 'October 2024'], ['Wonderful wildlife', 'The feeders right outside the window kept us entertained for hours. Nuthatches, woodpeckers, even a muntjac one morning. A nature-lover’s dream and beautifully kept.', 'Rachel M.', 'August 2024'], ]; function StarPicker({ value, onChange }) { const [hover, setHover] = useState(0); return (
{[1, 2, 3, 4, 5].map((n) => ( ))}
); } function ReviewForm() { const [form, setForm] = useState({ rating: 0, title: '', body: '', name: '', email: '', consent: false, website: '' }); const [state, setState] = useState('idle'); // idle | sending | done const [errors, setErrors] = useState([]); const set = (k) => (e) => setForm((f) => ({ ...f, [k]: e.target.type === 'checkbox' ? e.target.checked : e.target.value })); const submit = async (e) => { e.preventDefault(); setErrors([]); if (!form.rating) { setErrors(['Please choose a star rating.']); return; } setState('sending'); try { const fd = new FormData(); fd.append('rating', form.rating); fd.append('title', form.title); fd.append('body', form.body); fd.append('name', form.name); fd.append('email', form.email); fd.append('consent', form.consent ? '1' : ''); fd.append('website', form.website); // honeypot const res = await fetch('api/reviews.php', { method: 'POST', body: fd }); const data = await res.json().catch(() => ({})); if (res.ok && data.ok) { setState('done'); } else { setErrors(data.errors || ['Something went wrong — please try again.']); setState('idle'); } } catch (err) { setErrors(['Could not send your review. Please try again, or email us.']); setState('idle'); } }; if (state === 'done') { return (
★★★★★

Thank you{form.name ? ', ' + form.name : ''}!

Your review has been sent to Nick and will appear on the site once it’s approved.

); } const labelStyle = { display: 'block', fontWeight: 600, color: 'var(--text-strong)', fontSize: 14.5, margin: '0 0 6px' }; return (
Your overall rating setForm((f) => ({ ...f, rating: n }))} />