function EventsSection() {
const mobile = useMobile();
const [view, setView] = useState("list");
const [filter, setFilter] = useState("Tutti");
const types = ["Tutti", ...new Set(EVENTS.map(e => e.type.split(" · ")[0]))];
const shown = filter === "Tutti" ? EVENTS : EVENTS.filter(e => e.type.includes(filter));
return (
Prossimi eventi in Calabria
{[["list", "Elenco"], ["calendar", "Calendario"]].map(([k, l]) => (
))}
{types.map(t => (
))}
{(view === "list" || mobile) ?
:
}
);
}
function EventsList({ items, mobile }) {
const [hoverIdx, setHoverIdx] = useState(null);
return (
{items.map((e, i) => (
setHoverIdx(i)}
onMouseLeave={() => setHoverIdx(null)}
style={{
display: "grid",
gridTemplateColumns: mobile ? "64px 1fr" : "100px 1fr auto 40px",
alignItems: "center", gap: mobile ? 16 : 32,
padding: mobile ? "20px 8px" : "28px 12px",
borderBottom: "1px solid var(--line)",
background: hoverIdx === i ? "var(--paper-2)" : "transparent",
transition: "background .25s",
}}>
{String(e.day).padStart(2, "0")}
{e.month}
{e.type}
{e.title}
{e.place}
{!mobile && {e.dek}
}
{!mobile &&
}
))}
);
}
function EventsCalendar({ items }) {
// Mini calendario aprile+maggio 2026 marcato con eventi
const months = [
{ name: "Aprile", short: "APR", days: 30, startDow: 3 }, // 1 apr 2026 mercoledì
{ name: "Maggio", short: "MAG", days: 31, startDow: 5 }, // 1 mag 2026 venerdì
];
const dayMap = {};
items.forEach(e => { dayMap[`${e.month}-${e.day}`] = e; });
const dow = ["L", "M", "M", "G", "V", "S", "D"];
const [hoverEv, setHoverEv] = useState(null);
return (
{months.map(m => {
const cells = [];
for (let i = 1; i < m.startDow; i++) cells.push(null);
for (let d = 1; d <= m.days; d++) cells.push(d);
while (cells.length % 7 !== 0) cells.push(null);
return (
{dow.map((d, i) => (
{d}
))}
{cells.map((d, i) => {
const ev = d ? dayMap[`${m.short}-${d}`] : null;
return (
ev && setHoverEv(ev)}
onMouseLeave={() => setHoverEv(null)}
style={{
aspectRatio: "1/1", display: "flex", alignItems: "center", justifyContent: "center",
position: "relative", fontSize: 13, fontFamily: "var(--font-mono)",
color: d ? "var(--ink)" : "transparent",
background: ev ? "var(--ocra)" : "transparent",
border: ev ? "none" : "1px solid transparent",
cursor: ev ? "pointer" : "default",
}}>
{d || "."}
{ev &&
}
);
})}
);
})}
{hoverEv ? (
<>
{String(hoverEv.day).padStart(2, "0")}
{hoverEv.month}
{hoverEv.type}
{hoverEv.title}
{hoverEv.place}
{hoverEv.dek}
>
) : (
<>
{items.length} eventi in agenda
Passa sopra un giorno evidenziato per vedere l'evento.
I giorni in ocra segnalano eventi in programma. Clicca per consultare la scheda completa.
>
)}
);
}
window.EventsSection = EventsSection;