App.CategoryFilter = function CategoryFilter({ categories, activeId, onChange }) {
    return (
        <div className="category-filter">
            <button
                className={'filter-btn' + (!activeId ? ' active' : '')}
                onClick={() => onChange(null)}
            >
                All
            </button>
            {categories.map(cat => (
                <button
                    key={cat.id}
                    className={'filter-btn' + (activeId === cat.id ? ' active' : '')}
                    onClick={() => onChange(cat.id)}
                >
                    {cat.name} ({cat.car_count})
                </button>
            ))}
        </div>
    );
};
