diff --git a/src/Handle.jsx b/src/Handle.jsx
index 8a5449e..e3d16a5 100644
--- a/src/Handle.jsx
+++ b/src/Handle.jsx
@@ -35,7 +35,7 @@ export default class Handle extends React.Component {
noTip,
} = this.props;
- const style = vertical ? { bottom: offset + '%' } : { left: offset + '%' };
+ const style = vertical ? { bottom: `${offset}%` } : { left: `${offset}%` };
const handle = (
= lowerBound);
const markClassName = classNames({
- [className + '-text']: true,
- [className + '-text-active']: isActived,
+ [`${className}-text`]: true,
+ [`${className}-text-active`]: isActived,
});
const bottomStyle = {
// height: markWidth + '%',
- marginBottom: '-200' + '%',
- bottom: (point - min) / range * 100 + '%',
+ marginBottom: '-200%',
+ bottom: `${(point - min) / range * 100}%`,
};
const leftStyle = {
- width: markWidth + '%',
- marginLeft: -markWidth / 2 + '%',
- left: (point - min) / range * 100 + '%',
+ width: `${markWidth}%`,
+ marginLeft: `${-markWidth / 2}%`,
+ left: `${(point - min) / range * 100}%`,
};
const style = vertical ? bottomStyle : leftStyle;
diff --git a/src/Slider.jsx b/src/Slider.jsx
index a83e929..beed01d 100644
--- a/src/Slider.jsx
+++ b/src/Slider.jsx
@@ -364,11 +364,15 @@ class Slider extends React.Component {
addDocumentEvents(type) {
if (type === 'touch') {
// just work for chrome iOS Safari and Android Browser
- this.onTouchMoveListener = addEventListener(document, 'touchmove', this.onTouchMove.bind(this));
- this.onTouchUpListener = addEventListener(document, 'touchend', this.end.bind(this, 'touch'));
+ this.onTouchMoveListener =
+ addEventListener(document, 'touchmove', this.onTouchMove.bind(this));
+ this.onTouchUpListener =
+ addEventListener(document, 'touchend', this.end.bind(this, 'touch'));
} else if (type === 'mouse') {
- this.onMouseMoveListener = addEventListener(document, 'mousemove', this.onMouseMove.bind(this));
- this.onMouseUpListener = addEventListener(document, 'mouseup', this.end.bind(this, 'mouse'));
+ this.onMouseMoveListener =
+ addEventListener(document, 'mousemove', this.onMouseMove.bind(this));
+ this.onMouseUpListener =
+ addEventListener(document, 'mouseup', this.end.bind(this, 'mouse'));
}
}
@@ -413,7 +417,7 @@ class Slider extends React.Component {
const offsets = bounds.map(v => this.calcOffset(v));
- const handleClassName = prefixCls + '-handle';
+ const handleClassName = `${prefixCls}-handle`;
const handlesClassNames = bounds.map((v, i) => classNames({
[handleClassName]: true,
@@ -451,33 +455,36 @@ class Slider extends React.Component {
[`${prefixCls}-track-${i}`]: true,
});
tracks.push(
-
+
);
}
const sliderClassName = classNames({
[prefixCls]: true,
- [prefixCls + '-disabled']: disabled,
+ [`${prefixCls}-disabled`]: disabled,
[className]: !!className,
- [prefixCls + '-vertical']: this.props.vertical,
+ [`${prefixCls}-vertical`]: this.props.vertical,
});
return (
-
- {tracks}
-
- {handles}
-
- {children}
-
+
+ {tracks}
+
+ {handles}
+
+ {children}
+
);
}
}
diff --git a/src/Steps.jsx b/src/Steps.jsx
index 8234148..5c4da08 100644
--- a/src/Steps.jsx
+++ b/src/Steps.jsx
@@ -3,7 +3,10 @@ import classNames from 'classnames';
import warning from 'warning';
function calcPoints(vertical, marks, dots, step, min, max) {
- warning(dots ? step > 0 : 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) {
@@ -18,20 +21,20 @@ const Steps = ({ prefixCls, vertical, marks, dots, step, included,
lowerBound, upperBound, max, min }) => {
const range = max - min;
const elements = calcPoints(vertical, marks, dots, step, min, max).map((point) => {
- const offset = Math.abs(point - min) / range * 100 + '%';
+ const offset = `${Math.abs(point - min) / range * 100}%`;
const style = vertical ? { bottom: offset } : { left: offset };
const isActived = (!included && point === upperBound) ||
(included && point <= upperBound && point >= lowerBound);
const pointClassName = classNames({
- [prefixCls + '-dot']: true,
- [prefixCls + '-dot-active']: isActived,
+ [`${prefixCls}-dot`]: true,
+ [`${prefixCls}-dot-active`]: isActived,
});
return
;
});
- return
{elements}
;
+ return
{elements}
;
};
export default Steps;
diff --git a/src/Track.jsx b/src/Track.jsx
index dcc2cbe..32e9859 100644
--- a/src/Track.jsx
+++ b/src/Track.jsx
@@ -5,11 +5,11 @@ const Track = ({ className, included, vertical, offset, length }) => {
visibility: included ? 'visible' : 'hidden',
};
if (vertical) {
- style.bottom = offset + '%';
- style.height = length + '%';
+ style.bottom = `${offset}%`;
+ style.height = `${length}%`;
} else {
- style.left = offset + '%';
- style.width = length + '%';
+ style.left = `${offset}%`;
+ style.width = `${length}%`;
}
return
;
};
diff --git a/tests/index.js b/tests/index.js
index 8c878a3..325139c 100644
--- a/tests/index.js
+++ b/tests/index.js
@@ -1,3 +1,4 @@
+/* eslint-disable max-len */
const expect = require('expect.js');
const React = require('react');
const ReactDOM = require('react-dom');