3,200+ hardcoded color values replaced with CSS variable-backed Tailwind classes (bg-card, text-foreground, border-border, etc.). Enables light mode via CSS variable swap. Only syntax highlighting colors and intentional one-offs remain hardcoded (~15 values). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { ArrowUpDown } from 'lucide-react'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
type SortBy = 'usage_count' | 'updated_at' | 'created_at' | 'name' | 'name_desc' | 'version'
|
|
|
|
interface SortDropdownProps {
|
|
value: SortBy
|
|
onChange: (sortBy: SortBy) => void
|
|
className?: string
|
|
}
|
|
|
|
const sortOptions: { value: SortBy; label: string }[] = [
|
|
{ value: 'usage_count', label: 'Most Used' },
|
|
{ value: 'updated_at', label: 'Recently Updated' },
|
|
{ value: 'created_at', label: 'Recently Created' },
|
|
{ value: 'name', label: 'Name (A-Z)' },
|
|
{ value: 'name_desc', label: 'Name (Z-A)' },
|
|
{ value: 'version', label: 'Version Number' },
|
|
]
|
|
|
|
export function SortDropdown({ value, onChange, className }: SortDropdownProps) {
|
|
return (
|
|
<div className={cn('relative inline-flex items-center', className)}>
|
|
<span className="mr-2 flex items-center gap-1.5 text-sm text-muted-foreground">
|
|
<ArrowUpDown className="h-4 w-4" />
|
|
<span className="hidden sm:inline">Sort:</span>
|
|
</span>
|
|
<select
|
|
value={value}
|
|
onChange={(e) => onChange(e.target.value as SortBy)}
|
|
className={cn(
|
|
'rounded-md border border-border bg-card px-3 py-1.5 text-sm',
|
|
'text-foreground focus:border-primary focus:outline-hidden focus:ring-1 focus:ring-primary/20'
|
|
)}
|
|
>
|
|
{sortOptions.map((option) => (
|
|
<option key={option.value} value={option.value}>
|
|
{option.label}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
)
|
|
}
|