-
Notifications
You must be signed in to change notification settings - Fork 498
/
index.js
42 lines (34 loc) · 963 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var React = require('react');
var Nouislider = require('react-nouislider');
var autoHide = require('../../decorators/autoHide');
require('style?prepend!raw!./index.css');
var cssPrefix = 'as-range-slider--';
class Slider extends React.Component {
// we are only interested in rawValues
handleChange(formattedValues, handleId, rawValues) {
this.props.onChange(rawValues);
}
render() {
return (
<Nouislider
{...this.props}
onChange={this.handleChange.bind(this)}
animate={false}
behaviour={'snap'}
connect
cssPrefix={cssPrefix}
/>
);
}
}
Slider.propTypes = {
onSlide: React.PropTypes.func,
onChange: React.PropTypes.func,
range: React.PropTypes.object.isRequired,
start: React.PropTypes.arrayOf(React.PropTypes.number).isRequired,
tooltips: React.PropTypes.oneOfType([
React.PropTypes.bool,
React.PropTypes.object
])
};
module.exports = autoHide(Slider);