import { useState } from 'react'; import { Search, Filter } from 'lucide-react'; import { VendorListing, VendorCategory } from '@/types/vendors'; import { VENDOR_LISTINGS } from '@/data/vendors'; import VendorCard from '@/components/vendor/VendorCard'; import VendorModal from '@/components/vendor/VendorModal'; import { cn } from '@/lib/utils'; const CATEGORIES: VendorCategory[] = [ 'venue', 'services', 'attire', 'catering', 'music', 'flowers', 'transport', 'stationery' ]; const LOCATIONS = Array.from( new Set(VENDOR_LISTINGS.map(vendor => vendor.location)) ).sort(); const PRICE_RANGES = [ { value: 'all', label: 'All Price Ranges' }, { value: '£', label: '£ - Budget Friendly' }, { value: '££', label: '££ - Moderate' }, { value: '£££', label: '£££ - Premium' }, { value: '££££', label: '££££ - Luxury' }, { value: '£££££', label: '£££££ - Ultra Luxury' } ]; const Vendors = () => { const [selectedCategory, setSelectedCategory] = useState('all'); const [selectedLocation, setSelectedLocation] = useState('all'); const [searchQuery, setSearchQuery] = useState(''); const [selectedVendor, setSelectedVendor] = useState(null); const [priceRange, setPriceRange] = useState('all'); const [showFilters, setShowFilters] = useState(false); const filteredVendors = VENDOR_LISTINGS.filter(vendor => { const matchesCategory = selectedCategory === 'all' || vendor.category === selectedCategory; const matchesLocation = selectedLocation === 'all' || vendor.location === selectedLocation; const matchesPrice = priceRange === 'all' || vendor.priceRange === priceRange; const matchesSearch = vendor.name.toLowerCase().includes(searchQuery.toLowerCase()) || vendor.description.toLowerCase().includes(searchQuery.toLowerCase()); return matchesCategory && matchesLocation && matchesPrice && matchesSearch; }); return (
{/* Header */}

Vendor Directory

Discover the finest establishments and services to ensure your special day is nothing short of perfect. From grand estates to skilled artisans, find everything you need for a celebration worthy of a Jane Austen novel.

{/* Search and Filters */}
{/* Search Bar and Filter Toggle */}
setSearchQuery(e.target.value)} className="w-full pl-10 pr-4 py-3 rounded-lg border border-sage-200 focus:ring-sage-500 focus:border-sage-500" />
{/* Filter Controls */} {showFilters && (
{/* Categories */}
{CATEGORIES.map(category => ( ))}
{/* Locations */}
{LOCATIONS.map(location => ( ))}
{/* Price Ranges */}
{PRICE_RANGES.map(({ value, label }) => ( ))}
)}
{/* Results Count */}
{filteredVendors.length} {filteredVendors.length === 1 ? 'vendor' : 'vendors'} found
{/* Vendor Grid */}
{filteredVendors.map((vendor) => ( setSelectedVendor(vendor)} /> ))}
{/* No Results Message */} {filteredVendors.length === 0 && (

No vendors found matching your criteria

Try adjusting your filters or search terms

)} {/* Vendor Modal */} {selectedVendor && ( setSelectedVendor(null)} /> )}
); }; export default Vendors;