dify/web/app/components/base/slider/index.tsx
Joel 888e8c6dac
feat: add retriever rank fe (#1557)
Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
2023-11-18 11:53:35 +08:00

30 lines
663 B
TypeScript

import ReactSlider from 'react-slider'
import cn from 'classnames'
import './style.css'
type ISliderProps = {
className?: string
value: number
max?: number
min?: number
step?: number
disabled?: boolean
onChange: (value: number) => void
}
const Slider: React.FC<ISliderProps> = ({ className, max, min, step, value, disabled, onChange }) => {
return <ReactSlider
disabled={disabled}
value={isNaN(value) ? 0 : value}
min={min || 0}
max={max || 100}
step={step || 1}
className={cn(className, 'slider')}
thumbClassName="slider-thumb"
trackClassName="slider-track"
onChange={onChange}
/>
}
export default Slider