/* Down The Cove homepage — reviews, guides, newsletter, footer, overlays */
const { Button, Input } = window.DownTheCoveDesignSystem_3cc6fe;
const MIcon = window.DtcIcon;
function Stars({ value, size = 13 }) {
return (
{[0, 1, 2, 3, 4].map((i) => (
))}
);
}
function Reviews({ reviews }) {
return (
Loved along the coast & beyond
Real shoppers, real advice
4.8
Rated excellent · 2,400+ reviews
{reviews.map((r, i) => (
“{r.text}”
{r.name.charAt(0)}
Verified
))}
);
}
function Guides({ guides, onAll }) {
return (
);
}
function Newsletter() {
const [email, setEmail] = React.useState("");
const [done, setDone] = React.useState(false);
const [err, setErr] = React.useState("");
const submit = (e) => {
e.preventDefault();
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { setErr("Pop in a valid email address."); return; }
setErr(""); setDone(true);
};
return (
10% off your first order over £30
Join the list for coastal tips, new arrivals and the odd members' offer. No spam — just useful things.
{done ? (
You're in — check your inbox for the code.
) : (
)}
By signing up you agree to our privacy policy. Unsubscribe anytime.
);
}
function FooterCol({ col }) {
const [open, setOpen] = React.useState(false);
return (
);
}
function Footer() {
const cols = [
{ h: "Shop the cove", links: ["Fishing gear", "Cook shop", "Food smoking", "Home decor", "Coastal gifts"] },
{ h: "Learn & explore", links: ["Knowledge guides", "Recipes", "Species finder", "Coastlines"] },
{ h: "Help & orders", links: ["Delivery & returns", "Track an order", "Contact us", "FAQs"] },
{ h: "Join us", links: ["Cove Club", "Wholesale", "Affiliates", "Gift cards"] },
];
const trust = [
{ i: "truck", t: "Free delivery over £30" },
{ i: "map-pin", t: "Founded in Cornwall" },
{ i: "heart", t: "Family-owned & helpful" },
{ i: "shield-check", t: "Secure checkout" },
];
return (
);
}
/* ── Search overlay ───────────────────────────────────────── */
function SearchOverlay({ open, query, onQuery, onClose, results, onPick }) {
const inputRef = React.useRef(null);
React.useEffect(() => { if (open && inputRef.current) setTimeout(() => inputRef.current.focus(), 80); }, [open]);
const suggestions = ["Father's Day gifts", "Smoking kit", "Crabbing set", "Seafood tools", "Under £30"];
return (
{!query.trim() ? (
Popular searches
{suggestions.map((s) => (
))}
Trending products
) : (
{results.length} result{results.length === 1 ? "" : "s"}
)}
);
}
/* ── Cart bottom sheet ────────────────────────────────────── */
function CartSheet({ open, items, products, onClose, onQty }) {
const byId = Object.fromEntries(products.map((p) => [p.id, p]));
const lines = Object.entries(items).filter(([, q]) => q > 0);
const total = lines.reduce((s, [id, q]) => s + q * parseFloat(byId[id].price.replace("£", "")), 0);
const met = total >= 30;
const pct = Math.min(100, (total / 30) * 100);
return (
Your basket{lines.length ? ` · ${lines.reduce((a, [, q]) => a + q, 0)}` : ""}
{lines.length === 0 ? (
Your basket's empty.
Let's find something useful.
) : (
{met ? "You've unlocked free UK delivery." : `Add £${(30 - total).toFixed(2)} more for free delivery.`}
{lines.map(([id, q]) => {
const p = byId[id];
return (
{p.name}
{p.cat}
{q}
{p.price}
);
})}
Subtotal£{total.toFixed(2)}
Taxes included. Delivery calculated at checkout.
}>Secure checkout
)}
);
}
Object.assign(window, { Reviews, Guides, Newsletter, Footer, SearchOverlay, CartSheet });