-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs page by splitting up examples
- Also fixed prepend/append of value
- Loading branch information
cchaos
committed
Feb 20, 2019
1 parent
7f33024
commit ebaa1c4
Showing
14 changed files
with
655 additions
and
220 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React, { | ||
Component, | ||
Fragment, | ||
} from 'react'; | ||
|
||
import { | ||
EuiRange, | ||
EuiSpacer, | ||
EuiDualRange, | ||
} from '../../../../src/components'; | ||
|
||
import makeId from '../../../../src/components/form/form_row/make_id'; | ||
|
||
export default class extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
value: '20', | ||
dualValue: [20, 100], | ||
}; | ||
} | ||
|
||
onChange = e => { | ||
this.setState({ | ||
value: e.target.value, | ||
}); | ||
}; | ||
|
||
onDualChange = (value) => { | ||
this.setState({ | ||
dualValue: value | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fragment> | ||
<EuiRange | ||
id={makeId()} | ||
value={this.state.value} | ||
onChange={this.onChange} | ||
showInput | ||
/> | ||
|
||
<EuiSpacer size="xl" /> | ||
|
||
<EuiDualRange | ||
id={makeId()} | ||
value={this.state.dualValue} | ||
onChange={this.onDualChange} | ||
showInput | ||
/> | ||
</Fragment> | ||
); | ||
} | ||
} |
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,80 @@ | ||
import React, { | ||
Component, | ||
Fragment, | ||
} from 'react'; | ||
|
||
import { | ||
EuiRange, | ||
EuiSpacer, | ||
EuiFormHelpText, | ||
EuiDualRange, | ||
} from '../../../../src/components'; | ||
|
||
import makeId from '../../../../src/components/form/form_row/make_id'; | ||
|
||
export default class extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.levels = [ | ||
{ | ||
min: 0, | ||
max: 20, | ||
color: 'danger' | ||
}, | ||
{ | ||
min: 20, | ||
max: 100, | ||
color: 'success' | ||
} | ||
]; | ||
|
||
this.state = { | ||
value: '20', | ||
dualValue: [20, 100], | ||
}; | ||
} | ||
|
||
onChange = e => { | ||
this.setState({ | ||
value: e.target.value, | ||
}); | ||
}; | ||
|
||
onDualChange = (value) => { | ||
this.setState({ | ||
dualValue: value | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fragment> | ||
<EuiRange | ||
id={makeId()} | ||
value={this.state.value} | ||
onChange={this.onChange} | ||
showTicks | ||
tickInterval={20} | ||
levels={this.levels} | ||
aria-describedby="levelsHelp2" | ||
/> | ||
<EuiFormHelpText id="levelsHelp2">Recommended levels are {this.levels[1].min} and above.</EuiFormHelpText> | ||
|
||
<EuiSpacer size="xl" /> | ||
|
||
<EuiDualRange | ||
id={makeId()} | ||
value={this.state.dualValue} | ||
onChange={this.onDualChange} | ||
showTicks | ||
ticks={[{ label: '20kb', value: 20 }, { label: '100kb', value: 100 }]} | ||
showInput | ||
levels={this.levels} | ||
aria-describedby="levelsHelp3" | ||
/> | ||
<EuiFormHelpText id="levelsHelp3">Recommended size is {this.levels[1].min}kb and above.</EuiFormHelpText> | ||
</Fragment> | ||
); | ||
} | ||
} |
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.