Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin-front committed Dec 20, 2017
1 parent 79c091e commit 2743c4f
Showing 1 changed file with 11 additions and 40 deletions.
51 changes: 11 additions & 40 deletions examples/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,54 +117,21 @@ class ControlledRangeDisableAcross extends React.Component {
super(props);
this.state = {
value: [20, 40, 60, 80],
enablePushable: true,
pushable: 5,
};
}
handleChange = (value) => {
this.setState({
value,
});
}
enablePushable = e => {
this.setState({
enablePushable: e.target.checked,
});
}
changePushable = e => {
this.setState({
pushable: e.target.value || 0,
});
}
render() {
return (
<div>
<label htmlFor="enpushable">enable pushable:</label>
<input
type="checkbox"
name="enpushable"
onChange={this.enablePushable}
checked={this.state.enablePushable}
/>
<br />
<label htmlFor="pushable">pushable:</label>
<input
type="number"
name="pushable"
onChange={this.changePushable}
value={this.state.pushable}
disabled={!this.state.enablePushable}
/>
<br />
<br />
<Range
value={this.state.value}
onChange={this.handleChange}
allowCross={false}
pushable={this.state.enablePushable && this.state.pushable}
{...this.props}
/>
</div>
<Range
value={this.state.value}
onChange={this.handleChange}
allowCross={false}
{...this.props}
/>
);
}
}
Expand Down Expand Up @@ -213,9 +180,13 @@ ReactDOM.render(
<ControlledRange />
</div>
<div style={style}>
<p>Controlled Range, not allow across, with pushable</p>
<p>Controlled Range, not allow across</p>
<ControlledRangeDisableAcross />
</div>
<div style={style}>
<p>Controlled Range, not allow across, pushable=5</p>
<ControlledRangeDisableAcross pushable={5} />
</div>
<div style={style}>
<p>Multi Range</p>
<Range count={3} defaultValue={[20, 40, 60, 80]} pushable />
Expand Down

0 comments on commit 2743c4f

Please sign in to comment.