Spaces:
Running
Running
Download bioai-platform/frontend/src/components/ui/ClaySlider.tsx from Samad14/bio-nexus-api: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/spaces/Samad14/bio-nexus-api/resolve/main/bioai-platform/frontend/src/components/ui/ClaySlider.tsx
- Command line
-
hf download hf://spaces/Samad14/bio-nexus-api/bioai-platform/frontend/src/components/ui/ClaySlider.tsx
-
curl -L -o ClaySlider.tsx https://huggingface.co/spaces/Samad14/bio-nexus-api/resolve/main/bioai-platform/frontend/src/components/ui/ClaySlider.tsx
1.36 kB
| 'use client'; | |
| import type { CSSProperties } from 'react'; | |
| /** | |
| * Claymorphism slider — for numeric, isolated, non-critical inputs | |
| * (MD run length, search hit count, bootstrap cutoff, etc.). | |
| */ | |
| interface ClaySliderProps { | |
| label?: string; | |
| value: number; | |
| min: number; | |
| max: number; | |
| step?: number; | |
| unit?: string; | |
| onChange: (value: number) => void; | |
| disabled?: boolean; | |
| className?: string; | |
| } | |
| export function ClaySlider({ | |
| label, | |
| value, | |
| min, | |
| max, | |
| step = 1, | |
| unit, | |
| onChange, | |
| disabled, | |
| className = '', | |
| }: ClaySliderProps) { | |
| const pct = ((value - min) / (max - min)) * 100; | |
| return ( | |
| <div className={`flex flex-col gap-1.5 ${disabled ? 'opacity-40' : ''} ${className}`}> | |
| <div className="flex items-center justify-between"> | |
| {label && <span className="text-sm text-text-primary">{label}</span>} | |
| <span className="font-mono text-xs text-accent-cyan"> | |
| {value} | |
| {unit ? ` ${unit}` : ''} | |
| </span> | |
| </div> | |
| <input | |
| type="range" | |
| role="slider" | |
| aria-label={label} | |
| min={min} | |
| max={max} | |
| step={step} | |
| value={value} | |
| disabled={disabled} | |
| onChange={(e) => onChange(Number(e.target.value))} | |
| className="clay-slider w-full" | |
| style={{ '--fill': `${pct}%` } as CSSProperties} | |
| /> | |
| </div> | |
| ); | |
| } | |