mirror of
https://github.com/wassname/slider.git
synced 2026-09-09 11:35:22 +08:00
refactor: simplify code
This commit is contained in:
+1
-7
@@ -46,13 +46,7 @@ class Slider extends React.Component {
|
||||
|
||||
let recent;
|
||||
if (props.range && upperBound === lowerBound) {
|
||||
if (lowerBound === max) {
|
||||
recent = 'lowerBound';
|
||||
} else if (upperBound === min) {
|
||||
recent = 'upperBound';
|
||||
} else {
|
||||
recent = 'upperBound';
|
||||
}
|
||||
recent = lowerBound === max ? 'lowerBound' : 'upperBound';
|
||||
} else {
|
||||
recent = 'upperBound';
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
||||
import warning from 'warning';
|
||||
|
||||
function calcPoints(vertical, marks, dots, step, min, max) {
|
||||
warning(dots ? step : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');
|
||||
warning(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');
|
||||
const points = Object.keys(marks).map(parseFloat);
|
||||
if (dots) {
|
||||
for (let i = min; i <= max; i = i + step) {
|
||||
|
||||
Reference in New Issue
Block a user