Best-sellers

import { useState } from ‘react’; import { Link } from ‘react-router-dom’; import { Filter, X, ChevronDown, Home, ChevronRight, TrendingUp, Sparkles, ArrowRight } from ‘lucide-react’; import ProductCard from ‘../components/ProductCard’; import { mockProducts, categories } from ‘../data/mockProducts’; export default function BestSellers() { const [selectedCategory, setSelectedCategory] = useState(‘all’); const [priceRange, setPriceRange] = useState(‘all’); const [sortBy, setSortBy] = useState(‘popularity’); const [showFilters, setShowFilters] = useState(false); const bestSellerProducts = mockProducts.filter((product) => product.isBestSeller); const filteredProducts = bestSellerProducts.filter((product) => { if (selectedCategory !== ‘all’ && product.category !== selectedCategory) { return false; } if (priceRange !== ‘all’) { const price = product.salePrice || product.price; if (priceRange === ‘0-15′ && price > 15) return false; if (priceRange === ’15-25’ && (price < 15 || price > 25)) return false; if (priceRange === ’25+’ && price < 25) return false; } return true; }); const sortedProducts = [...filteredProducts].sort((a, b) => { if (sortBy === ‘price-asc’) return (a.salePrice || a.price) – (b.salePrice || b.price); if (sortBy === ‘price-desc’) return (b.salePrice || b.price) – (a.salePrice || a.price); if (sortBy === ‘name’) return a.name.localeCompare(b.name); return 0; }); const newProducts = mockProducts.filter((product) => product.isNew).slice(0, 4); return (

Best-sellers

Les produits préférés de notre communauté d’étudiants, testés et adorés

{sortedProducts.length} best-seller{sortedProducts.length > 1 ? ‘s’ :  »}

{sortedProducts.map((product) => ( ))}
{sortedProducts.length === 0 && (

Aucun best-seller dans cette catégorie

Essaie d’ajuster tes filtres

)}
{newProducts.length > 0 && (

Découvre aussi nos nouveautés

Les derniers produits ajoutés à notre collection, frais et tendance

Voir les nouveautés
{newProducts.map((product) => (
{product.name}

{product.name}

{product.salePrice ? ( <> {product.price}€ {product.salePrice}€ ) : ( `${product.price}€` )}

))}
)}

Valeurs sûres

Produits plébiscités par nos clients

Qualité garantie

Testés et approuvés

Livraison gratuite

Dès 30€ d’achat

); }