({ className, min, max, step = 1, value, onChange })
| 11 | }; |
| 12 | |
| 13 | export const Slider: FC<Props> = ({ className, min, max, step = 1, value, onChange }) => { |
| 14 | const progress = ((value - min) / (max - min)) * 100; |
| 15 | |
| 16 | return ( |
| 17 | <input |
| 18 | type="range" |
| 19 | className={variants({ className })} |
| 20 | min={min} |
| 21 | max={max} |
| 22 | step={step} |
| 23 | value={value} |
| 24 | onChange={(e) => onChange(Number(e.target.value))} |
| 25 | style={ |
| 26 | { |
| 27 | background: `linear-gradient(to right, var(--primary) ${progress}%, var(--muted) ${progress}%)`, |
| 28 | '--progress': `${progress}%`, |
| 29 | } as React.CSSProperties |
| 30 | } |
| 31 | /> |
| 32 | ); |
| 33 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected