File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,11 @@ const SingleRangeSlider = function (props: SingleRangeSliderProps) {
52
52
}
53
53
54
54
/**
55
- * Returns the selected slice of the slider, in percent from 0 to 100 .
55
+ * Returns the selected slice of the slider, in percent considering range from defaultMinValue to defaultMaxValue .
56
56
*
57
- * @param newValue - New value set on the slider.
58
- * @returns Percent of the slider that need to be colored, from 0 to 100.
57
+ * @returns Percent of the slider that need to be colored.
59
58
*/
60
- const getSelectedSliderPercent = ( newValue : number ) => newValue / defaultMaxValue * 100
59
+ const getSelectedSliderPercent = ( ) => ( ( value - defaultMinValue ) * 100 ) / ( defaultMaxValue - defaultMinValue )
61
60
62
61
/**
63
62
* If `showLabels` is `true`, returns a `<div>` that contains a label with the current value of the slider.
@@ -70,7 +69,7 @@ const SingleRangeSlider = function (props: SingleRangeSliderProps) {
70
69
}
71
70
}
72
71
73
- const selectedPercent = `${ getSelectedSliderPercent ( value ) } %`
72
+ const selectedPercent = `${ getSelectedSliderPercent ( ) } %`
74
73
const disabledClass = disabled ? 'disabled' : ''
75
74
76
75
return (
You can’t perform that action at this time.
0 commit comments