-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add `vertical` props - add vertical slider demo: v-marks.html v-range.html v-slider.html refs:react-component/slider#18
- Loading branch information
1 parent
5dcb000
commit 04bb0b3
Showing
16 changed files
with
388 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require('rc-slider/assets/index.less'); | ||
|
||
const React = require('react'); | ||
const ReactDOM = require('react-dom'); | ||
const Slider = require('rc-slider'); | ||
|
||
const style = {height: 400, marginBottom: 50, marginLeft: 50}; | ||
const marks = { | ||
'-10': '-10°C', | ||
0: <strong>0°C</strong>, | ||
26: '26°C', | ||
37: '37°C', | ||
50: '50°C', | ||
100: { | ||
style: { | ||
color: 'red', | ||
}, | ||
label: <strong>100°C</strong>, | ||
}, | ||
}; | ||
|
||
function log(value) { | ||
console.log(value); | ||
} | ||
|
||
ReactDOM.render( | ||
<div> | ||
<p>Slider with marks, `step=null`</p> | ||
<div style={style}> | ||
<Slider vertical min={-10} marks={marks} step={null} onChange={log} defaultValue={20} /> | ||
</div> | ||
<p>Slider with marks and steps</p> | ||
<div style={style}> | ||
<Slider vertical dots min={-10} marks={marks} step={10} onChange={log} defaultValue={20} /> | ||
</div> | ||
<p>Slider with marks, `included=false`</p> | ||
<div style={style}> | ||
<Slider vertical min={-10} marks={marks} included={false} defaultValue={20} /> | ||
</div> | ||
<p>Slider with marks and steps, `included=false`</p> | ||
<div style={style}> | ||
<Slider vertical min={-10} marks={marks} step={10} included={false} defaultValue={20} /> | ||
</div> | ||
<p>Range with marks</p> | ||
<div style={style}> | ||
<Slider vertical min={-10} range marks={marks} onChange={log} defaultValue={[20, 40]} /> | ||
</div> | ||
<p>Range with marks and steps</p> | ||
<div style={style}> | ||
<Slider vertical min={-10} range marks={marks} step={10} onChange={log} defaultValue={[20, 40]} /> | ||
</div> | ||
</div> | ||
, document.getElementById('__react-content')); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* eslint react/no-multi-comp: 0 */ | ||
require('rc-slider/assets/index.less'); | ||
|
||
const React = require('react'); | ||
const ReactDOM = require('react-dom'); | ||
const Slider = require('rc-slider'); | ||
|
||
const style = {height: 400, marginBottom: 50, marginLeft: 50}; | ||
|
||
function log(value) { | ||
console.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 ( | ||
<div style={style}> | ||
<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 vertical allowCross={false} value={this.state.value} onChange={this.onSliderChange} /> | ||
</div> | ||
); | ||
}, | ||
}); | ||
|
||
const DynamicBounds = React.createClass({ | ||
getInitialState() { | ||
return { | ||
min: 0, | ||
max: 100, | ||
}; | ||
}, | ||
onSliderChange: function(value) { | ||
log(value); | ||
}, | ||
onMinChange: function(e) { | ||
this.setState({ | ||
min: +e.target.value || 0, | ||
}); | ||
}, | ||
onMaxChange: function(e) { | ||
this.setState({ | ||
max: +e.target.value || 100, | ||
}); | ||
}, | ||
render: function() { | ||
return ( | ||
<div style={style}> | ||
<label>Min: </label> | ||
<input type="number" value={this.state.min} onChange={this.onMinChange} /> | ||
<br /> | ||
<label>Max: </label> | ||
<input type="number" value={this.state.max} onChange={this.onMaxChange} /> | ||
<br /><br /> | ||
<Slider range vertical defaultValue={[20, 50]} min={this.state.min} max={this.state.max} onChange={this.onSliderChange} /> | ||
</div> | ||
); | ||
}, | ||
}); | ||
|
||
ReactDOM.render( | ||
<div> | ||
<p>Basic Range,`allowCross=false`</p> | ||
<div style={style}> | ||
<Slider range vertical allowCross={false} defaultValue={[0, 20]} onChange={log} /> | ||
</div> | ||
<p>Basic Range,`step=20` </p> | ||
<div style={style}> | ||
<Slider range vertical step={20} defaultValue={[20, 40]} onBeforeChange={log} /> | ||
</div> | ||
<p>Basic Range,`step=20, dots` </p> | ||
<div style={style}> | ||
<Slider range vertical dots step={20} defaultValue={[20, 40]} onAfterChange={log} /> | ||
</div> | ||
<p>Controlled Range</p> | ||
<div style={style}> | ||
<Slider range vertical value={[20, 40]} /> | ||
</div> | ||
<p>Customized Range</p> | ||
<div style={style}> | ||
<CustomizedRange /> | ||
</div> | ||
<p>Range with dynamic `max` `min`</p> | ||
<div style={style}> | ||
<DynamicBounds /> | ||
</div> | ||
</div> | ||
, document.getElementById('__react-content')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* eslint react/no-multi-comp: 0 */ | ||
require('rc-slider/assets/index.less'); | ||
|
||
const React = require('react'); | ||
const ReactDOM = require('react-dom'); | ||
const Slider = require('rc-slider'); | ||
|
||
const style = {height: 400, marginBottom: 50, marginLeft: 50}; | ||
|
||
function log(value) { | ||
console.log(value); | ||
} | ||
|
||
|
||
function percentFormatter(v) { | ||
return v + ' %'; | ||
} | ||
|
||
const CustomizedSlider = React.createClass({ | ||
getInitialState: function() { | ||
return { | ||
value: 50, | ||
}; | ||
}, | ||
onSliderChange: function(value) { | ||
log(value); | ||
this.setState({ | ||
value: value, | ||
}); | ||
}, | ||
render: function() { | ||
return <Slider vertical value={this.state.value} onChange={this.onSliderChange} />; | ||
}, | ||
}); | ||
|
||
const DynamicBounds = React.createClass({ | ||
getInitialState: function() { | ||
return { | ||
min: 0, | ||
max: 100, | ||
}; | ||
}, | ||
onSliderChange: function(value) { | ||
log(value); | ||
}, | ||
onMinChange: function(e) { | ||
this.setState({ | ||
min: +e.target.value || 0, | ||
}); | ||
}, | ||
onMaxChange: function(e) { | ||
this.setState({ | ||
max: +e.target.value || 100, | ||
}); | ||
}, | ||
render: function() { | ||
return ( | ||
<div style={style}> | ||
<label>Min: </label> | ||
<input type="number" value={this.state.min} onChange={this.onMinChange} /> | ||
<br /> | ||
<label>Max: </label> | ||
<input type="number" value={this.state.max} onChange={this.onMaxChange} /> | ||
<br /><br /> | ||
<Slider vertical defaultValue={50} min={this.state.min} max={this.state.max} onChange={this.onSliderChange} /> | ||
</div> | ||
); | ||
}, | ||
}); | ||
|
||
ReactDOM.render( | ||
<div> | ||
<p>Basic Slider</p> | ||
<div style={style}> | ||
<Slider vertical tipTransitionName="rc-slider-tooltip-zoom-down" onChange={log} /> | ||
</div> | ||
<p>Basic Slider,`step=20`</p> | ||
<div style={style}> | ||
<Slider vertical step={20} defaultValue={50} onBeforeChange={log} /> | ||
</div> | ||
<p>Basic Slider,`step=20, dots`</p> | ||
<div style={style}> | ||
<Slider vertical dots step={20} defaultValue={100} onAfterChange={log} /> | ||
</div> | ||
<p>Basic Slider with `tipFormatter`</p> | ||
<div style={style}> | ||
<Slider vertical tipFormatter={percentFormatter} tipTransitionName="rc-slider-tooltip-zoom-down" onChange={log} /> | ||
</div> | ||
<p>Basic Slider without tooltip</p> | ||
<div style={style}> | ||
<Slider vertical tipFormatter={null} onChange={log} /> | ||
</div> | ||
<p>Controlled Slider</p> | ||
<div style={style}> | ||
<Slider vertical value={50} /> | ||
</div> | ||
<p>Customized Slider</p> | ||
<div style={style}> | ||
<CustomizedSlider /> | ||
</div> | ||
<p>Slider with dynamic `min` `max`</p> | ||
<div> | ||
<DynamicBounds /> | ||
</div> | ||
</div> | ||
, document.getElementById('__react-content')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.