lucid-ui
Version:
A UI component library from AppNexus.
22 lines • 1.03 kB
JavaScript
import React from 'react';
import createClass from 'create-react-class';
import { SingleSelect } from '../../../index';
var Placeholder = SingleSelect.Placeholder,
Option = SingleSelect.Option;
export default createClass({
getInitialState: function getInitialState() {
return {
selectedIndex: null
};
},
handleSelect: function handleSelect(optionIndex) {
this.setState({
selectedIndex: optionIndex
});
},
render: function render() {
return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement(SingleSelect, {
onSelect: this.handleSelect
}, /*#__PURE__*/React.createElement(Placeholder, null, "Select Color"), /*#__PURE__*/React.createElement(Option, null, "Red"), /*#__PURE__*/React.createElement(Option, null, "Green"), /*#__PURE__*/React.createElement(Option, null, "Blue")), /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement("p", null, "Selected Index: ", JSON.stringify(this.state.selectedIndex))));
}
});