// MRB Auto storefront — Catalog / category listing page (mobile-first)
const _mkC = (n) => (props) => { const C = window.MRBAutoDesignSystem_73c751 && window.MRBAutoDesignSystem_73c751[n]; return C ? React.createElement(C, props) : null; };
const Icon = _mkC('Icon'), Button = _mkC('Button'), IconButton = _mkC('IconButton'), Badge = _mkC('Badge'),
ProductCard = _mkC('ProductCard'), Select = _mkC('Select'), TrustItem = _mkC('TrustItem'), Rating = _mkC('Rating');
const CAT_PRODUCTS = [
{ vehicle: 'Mercedes GLC X253', title: 'Marche-pieds alu GLC X253 & Coupé C253 (2015-2022)', price: 249, oldPrice: 319, badge: { label: 'Top vente', variant: 'top' }, monthly: '62 €/mois', cat: 'Marche-pieds', rating: 4.9 },
{ vehicle: 'Mercedes Classe E W213', title: 'Calandre look Panamericana AMG GT — W213', price: 149, badge: { label: 'Top vente', variant: 'top' }, monthly: '37 €/mois', cat: 'Calandres', rating: 4.8 },
{ vehicle: 'BMW X5 E70', title: "Kit extensions d'ailes BMW X5 E70 & LCI", price: 299, oldPrice: 379, badge: { label: 'Top vente', variant: 'top' }, monthly: '75 €/mois', cat: "Extensions d'ailes", rating: 4.7 },
{ vehicle: 'Audi A6 C8', title: 'Calandre Audi A6 C8 look RS', price: 199, badge: { label: 'Nouveau', variant: 'new' }, monthly: '50 €/mois', cat: 'Calandres', rating: 4.6 },
{ vehicle: 'Mercedes ML W164', title: 'Marche-pieds latéraux Mercedes ML W164', price: 299, oldPrice: 369, monthly: '75 €/mois', cat: 'Marche-pieds', rating: 4.8 },
{ vehicle: 'Land Rover Defender', title: 'Échelle latérale noir brillant Defender 90/110 2019+', price: 499, badge: { label: 'Nouveau', variant: 'new' }, monthly: '125 €/mois', cat: 'Marche-pieds', rating: 5 },
{ vehicle: 'Porsche Cayenne Coupé', title: 'Marche-pieds aluminium Cayenne Coupé 2018+', price: 699, monthly: '175 €/mois', cat: 'Marche-pieds', rating: 4.9 },
{ vehicle: 'Mercedes Classe A W176', title: 'Pare-chocs avant sport look A45 AMG (2012-2015)', price: 749, badge: { label: 'Nouveau', variant: 'new' }, monthly: '187 €/mois', cat: 'Pare-chocs & kits', rating: 4.7 },
{ vehicle: 'BMW Série 3 G20', title: 'Jantes 19" style M double-branche (jeu de 4)', price: 899, oldPrice: 1090, badge: { label: 'Promo', variant: 'sale' }, monthly: '225 €/mois', cat: 'Jantes', rating: 4.8, stock: 3 },
{ vehicle: 'VW Golf 7', title: 'Embouts d\'échappement inox look R (paire)', price: 89, monthly: '22 €/mois', cat: 'Échappement & déco', rating: 4.5 },
{ vehicle: 'Audi Q5 FY', title: 'Coques de rétroviseurs carbone Q5 FY', price: 159, oldPrice: 199, badge: { label: 'Promo', variant: 'sale' }, monthly: '40 €/mois', cat: 'Échappement & déco', rating: 4.6 },
{ vehicle: 'Mercedes GLE W167', title: 'Kit tapis + coffre sur-mesure GLE W167', price: 129, monthly: '32 €/mois', cat: 'Tapis & intérieur', rating: 4.9 },
];
const FILTER_CATS = ['Marche-pieds', 'Calandres', 'Pare-chocs & kits', "Extensions d'ailes", 'Jantes', 'Éclairage LED', 'Tapis & intérieur', 'Échappement & déco'];
const FILTER_BRANDS = ['Mercedes', 'BMW', 'Audi', 'Land Rover', 'Porsche', 'Volkswagen'];
function FilterCheck({ label, count, checked, onChange }) {
return (
{checked && }
{label}
{count != null && {count} }
);
}
function FilterGroup({ title, children, defaultOpen = true }) {
const [open, setOpen] = React.useState(defaultOpen);
return (
setOpen((o) => !o)} style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', width: '100%', background: 'transparent', border: 'none', cursor: 'pointer', padding: 0 }}>
{title}
{open &&
{children}
}
);
}
function Filters({ state, setState }) {
const toggle = (key, val) => setState((s) => {
const set = new Set(s[key]);
set.has(val) ? set.delete(val) : set.add(val);
return { ...s, [key]: set };
});
const countByCat = (c) => CAT_PRODUCTS.filter((p) => p.cat === c).length;
const countByBrand = (b) => CAT_PRODUCTS.filter((p) => p.vehicle.startsWith(b)).length;
return (
{FILTER_CATS.map((c) => toggle('cat', c)} />)}
{FILTER_BRANDS.map((b) => toggle('brand', b)} />)}
{['< 150 €', '150 – 300 €', '300 – 600 €', '> 600 €'].map((p) => toggle('price', p)} />)}
toggle('avail', 'stock')} />
toggle('avail', 'promo')} />
);
}
function Breadcrumb({ items }) {
return (
{items.map((it, i) => (
{i > 0 && }
{it}
))}
);
}
function Catalog() {
const [cart, setCart] = React.useState(2);
const [drawer, setDrawer] = React.useState(false);
const [sort, setSort] = React.useState('pop');
const [state, setState] = React.useState({ cat: new Set(['Marche-pieds']), brand: new Set(), price: new Set(), avail: new Set() });
React.useEffect(() => { document.body.style.overflow = drawer ? 'hidden' : ''; return () => { document.body.style.overflow = ''; }; }, [drawer]);
// filtering
let items = CAT_PRODUCTS.filter((p) => {
if (state.cat.size && !state.cat.has(p.cat)) return false;
if (state.brand.size && ![...state.brand].some((b) => p.vehicle.startsWith(b))) return false;
if (state.avail.has('promo') && !p.oldPrice) return false;
if (state.price.size) {
const inRange = [...state.price].some((r) =>
(r === '< 150 €' && p.price < 150) || (r === '150 – 300 €' && p.price >= 150 && p.price < 300) ||
(r === '300 – 600 €' && p.price >= 300 && p.price < 600) || (r === '> 600 €' && p.price >= 600));
if (!inRange) return false;
}
return true;
});
if (sort === 'asc') items = [...items].sort((a, b) => a.price - b.price);
if (sort === 'desc') items = [...items].sort((a, b) => b.price - a.price);
if (sort === 'rating') items = [...items].sort((a, b) => (b.rating || 0) - (a.rating || 0));
const activeCount = state.cat.size + state.brand.size + state.price.size + state.avail.size;
return (
{}} active="Catégories" />
{/* Page hero */}
Relooking & carrosserie
Marche-pieds & seuils
Marche-pieds aluminium et échelles latérales, montés sur les points d'origine — sans perçage. Sélectionnez votre véhicule pour n'afficher que les modèles compatibles.
{/* Toolbar */}
{items.length} résultat{items.length > 1 ? 's' : ''}
setDrawer(true)}
style={{ display: 'flex', alignItems: 'center', gap: 7, height: 40, padding: '0 16px', borderRadius: 'var(--radius-pill)', border: '1px solid var(--border-strong)', background: 'var(--surface-card)', cursor: 'pointer', fontFamily: 'var(--font-sans)', fontWeight: 700, fontSize: '13px', color: 'var(--text-primary)' }}>
Filtres{activeCount > 0 ? ` (${activeCount})` : ''}
setSort(e.target.value)} placeholder="Trier"
options={[{ value: 'pop', label: 'Popularité' }, { value: 'asc', label: 'Prix croissant' }, { value: 'desc', label: 'Prix décroissant' }, { value: 'rating', label: 'Les mieux notés' }]} />
{/* Layout */}
{items.length === 0 ? (
Aucun produit
Élargissez vos filtres pour voir plus de résultats.
setState({ cat: new Set(), brand: new Set(), price: new Set(), avail: new Set() })}>Réinitialiser les filtres
) : (
<>
Voir plus de produits
>
)}
{/* Mobile filter drawer */}
setDrawer(false)} />
Filtres
setDrawer(false)} />
setState({ cat: new Set(), brand: new Set(), price: new Set(), avail: new Set() })}>Effacer
setDrawer(false)}>Voir {items.length} résultats
);
}
// mount
(function mount() {
const ns = window.MRBAutoDesignSystem_73c751;
if (!ns || typeof ns.Icon !== 'function' || !window.MRBHeader || !window.MRBFooter) return setTimeout(mount, 30);
const el = document.getElementById('page-root');
if (!el || el.__mounted) return;
el.__mounted = true;
ReactDOM.createRoot(el).render(
);
})();