-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cchaos
committed
Jun 26, 2018
1 parent
2a4c254
commit 42a4b9e
Showing
5 changed files
with
215 additions
and
38 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,65 @@ | ||
import React, { | ||
Component, | ||
Fragment, | ||
} from 'react'; | ||
|
||
import { | ||
EuiSuperSelect, | ||
EuiHealth, | ||
} from '../../../../src/components'; | ||
|
||
export default class extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.options = [ | ||
{ | ||
value: 'warning', | ||
inputDisplay: ( | ||
<EuiHealth color="subdued"> | ||
Warning | ||
</EuiHealth> | ||
), | ||
}, | ||
{ | ||
value: 'minor', | ||
inputDisplay: ( | ||
<EuiHealth color="warning"> | ||
Minor | ||
</EuiHealth> | ||
), | ||
}, | ||
{ | ||
value: 'critical', | ||
inputDisplay: ( | ||
<EuiHealth color="danger"> | ||
Critical | ||
</EuiHealth> | ||
), | ||
}, | ||
]; | ||
|
||
this.state = { | ||
value: this.options[1].value, | ||
}; | ||
} | ||
|
||
onChange = (value) => { | ||
this.setState({ | ||
value: value, | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fragment> | ||
<EuiSuperSelect | ||
options={this.options} | ||
valueOfSelected={this.state.value} | ||
onChange={this.onChange} | ||
aria-label="Health levels" | ||
/> | ||
</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,83 @@ | ||
import React, { | ||
Component, | ||
Fragment, | ||
} from 'react'; | ||
|
||
import { | ||
EuiSuperSelect, | ||
EuiSpacer, | ||
EuiText, | ||
} from '../../../../src/components'; | ||
|
||
export default class extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.options = [ | ||
{ | ||
value: 'option_one', | ||
inputDisplay: 'Option one', | ||
dropdownDisplay: ( | ||
<Fragment> | ||
<strong>Option one</strong> | ||
<EuiSpacer size="xs" /> | ||
<EuiText size="s" color="subdued"> | ||
<p className="euiTextColor--subdued">Has a short description giving more detail to the option.</p> | ||
</EuiText> | ||
</Fragment> | ||
), | ||
}, | ||
{ | ||
value: 'option_two', | ||
inputDisplay: "Option two", | ||
dropdownDisplay: ( | ||
<Fragment> | ||
<strong>Option two</strong> | ||
<EuiSpacer size="xs" /> | ||
<EuiText size="s" color="subdued"> | ||
<p className="euiTextColor--subdued">Has a short description giving more detail to the option.</p> | ||
</EuiText> | ||
</Fragment> | ||
), | ||
}, | ||
{ | ||
value: 'option_three', | ||
inputDisplay: 'Option three', | ||
dropdownDisplay: ( | ||
<Fragment> | ||
<strong>Option three</strong> | ||
<EuiSpacer size="xs" /> | ||
<EuiText size="s" color="subdued"> | ||
<p className="euiTextColor--subdued">Has a short description giving more detail to the option.</p> | ||
</EuiText> | ||
</Fragment> | ||
), | ||
}, | ||
]; | ||
|
||
this.state = { | ||
value: this.options[1].value, | ||
}; | ||
} | ||
|
||
onChange = (value) => { | ||
this.setState({ | ||
value: value, | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fragment> | ||
<EuiSuperSelect | ||
options={this.options} | ||
valueOfSelected={this.state.value} | ||
onChange={this.onChange} | ||
itemLayoutAlign="top" | ||
hasDividers | ||
aria-label="Use aria labels when no actual label is in use" | ||
/> | ||
</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
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