{event.frontmatter.title}
{new Date(event.frontmatter.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
{event.frontmatter.description}
Read Moreimport React, { useState, useEffect } from 'react'; export default function EventFilterSearch({ events }) { const [searchTerm, setSearchTerm] = useState(''); const [selectedCategory, setSelectedCategory] = useState('All'); const [filteredEvents, setFilteredEvents] = useState(events); const categories = ['All', ...new Set(events.map(event => event.frontmatter.category))]; useEffect(() => { let tempEvents = events; // Filter by category if (selectedCategory !== 'All') { tempEvents = tempEvents.filter(event => event.frontmatter.category === selectedCategory); } // Filter by search term if (searchTerm) { tempEvents = tempEvents.filter(event => event.frontmatter.title.toLowerCase().includes(searchTerm.toLowerCase()) || event.frontmatter.description.toLowerCase().includes(searchTerm.toLowerCase()) ); } setFilteredEvents(tempEvents); }, [searchTerm, selectedCategory, events]); return (
{new Date(event.frontmatter.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
{event.frontmatter.description}
Read MoreNo events found matching your criteria.
)}