Skip to content

Commit 4cfa539

Browse files
author
Hai Nguyen
committed
Merge pull request #217 from daniellewissc/master
Add drag start/stop callbacks and exposed inline styling to slider
2 parents 4bbf52c + 6238b8f commit 4cfa539

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/js/slider.jsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ var Slider = React.createClass({
1515
error: React.PropTypes.string,
1616
description: React.PropTypes.string,
1717
name: React.PropTypes.string.isRequired,
18-
onChange: React.PropTypes.func
18+
onChange: React.PropTypes.func,
19+
onDragStart: React.PropTypes.func,
20+
onDragStop: React.PropTypes.func
1921
},
2022

2123
mixins: [Classable],
@@ -62,7 +64,7 @@ var Slider = React.createClass({
6264
if (percent > 1) percent = 1; else if (percent < 0) percent = 0;
6365

6466
return (
65-
<div className={classes}>
67+
<div className={classes} style={this.props.style}>
6668
<span className="mui-input-highlight"></span>
6769
<span className="mui-input-bar"></span>
6870
<span className="mui-input-description">{this.props.description}</span>
@@ -140,12 +142,14 @@ var Slider = React.createClass({
140142
this.setState({
141143
dragging: true
142144
});
145+
if (this.props.onDragStart) this.props.onDragStart(e, ui);
143146
},
144147

145148
_onDragStop: function(e, ui) {
146149
this.setState({
147150
dragging: false
148151
});
152+
if (this.props.onDragStop) this.props.onDragStop(e, ui);
149153
},
150154

151155
_onDragUpdate: function(e, ui) {

0 commit comments

Comments
 (0)