Skip to content

Commit

Permalink
docs: update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
blue-git-pro committed Mar 23, 2016
1 parent e9efa17 commit 5dcb000
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion examples/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,41 @@ function log(value) {
const CustomizedRange = React.createClass({
getInitialState: function() {
return {
lowerBound: 20,
upperBound: 40,
value: [20, 40],
};
},
onLowerBoundChange: function(e) {
this.setState({ lowerBound: +e.target.value });
},
onUpperBoundChange: function(e) {
this.setState({ upperBound: +e.target.value });
},
onSliderChange: function(value) {
log(value);
this.setState({
value: value,
});
},
handleApply: function() {
const { lowerBound, upperBound } = this.state;
this.setState({ value: [lowerBound, upperBound]});
},
render: function() {
return <Slider range value={this.state.value} onChange={this.onSliderChange} />;
return (
<div>
<label>LowerBound: </label>
<input type="number" value={this.state.lowerBound} onChange={this.onLowerBoundChange} />
<br />
<label>UpperBound: </label>
<input type="number" value={this.state.upperBound} onChange={this.onUpperBoundChange} />
<br />
<button onClick={this.handleApply}>Apply</button>
<br /><br />
<Slider range allowCross={false} value={this.state.value} onChange={this.onSliderChange} />
</div>
);
},
});

Expand Down

0 comments on commit 5dcb000

Please sign in to comment.