'use client'; import React, { useState } from 'react'; import { Button } from '@/components/ui/button'; import { RiEqualizerLine, RiArrowDownSLine, RiCheckLine, } from '@remixicon/react'; export interface ToolbarSortOption { label: string; } interface ProductToolbarProps { totalCount?: number | null; onOpenFilters: () => void; sortOptions: ToolbarSortOption[]; sortIndex: number; onSortChange: (index: number) => void; activeFilterCount?: number; } // Filters trigger on the left, item count and sort menu on the right — shared // by the search results and collection pages. const ProductToolbar: React.FC = ({ totalCount, onOpenFilters, sortOptions, sortIndex, onSortChange, activeFilterCount = 0, }) => { const [sortOpen, setSortOpen] = useState(false); return (
{typeof totalCount === 'number' && ( {totalCount} {totalCount === 1 ? 'Item' : 'Items'} )}
{sortOpen && ( <> {/* Click-away layer sits under the menu, above the page. */}
setSortOpen(false)} />
{sortOptions.map((option, index) => ( ))}
)}
); }; export default ProductToolbar;