import * as React from 'react'; import * as SliderPrimitive from '@radix-ui/react-slider'; import { cn } from '../lib/utils'; interface SliderProps { value: number[]; onValueChange: (value: number[]) => void; min?: number; max?: number; step?: number; className?: string; } export function Slider({ value, onValueChange, min = 0, max = 5, step = 1, className }: SliderProps) { const marks = React.useMemo(() => { const result = []; for (let i = min; i <= max; i += step) { result.push(i); } return result; }, [min, max, step]); return (
{marks.map((mark) => (
onValueChange([mark])} >
= mark ? "bg-purple-500 dark:bg-purple-400 font-bold" : "bg-gray-300 dark:bg-gray-700" )} /> L{mark}
))}
); }