UNPKG

fk-react-ui-components

Version:

Step 1 : Create a file in [ Seeds / Plants / Trees ] <br> Step 2 : It should export an Object with component name and story Component [Refer other components] <br> Step 3 : Story Component should return a react component <br> Step 3 : Created file should

47 lines (41 loc) 1.13 kB
import React from 'react'; import PropTypes from 'prop-types'; class SelectOption extends React.Component { constructor(props) { super(props); this.onClickHandler = this.onClickHandler.bind(this); } onClickHandler(event) { event.preventDefault(); event.stopPropagation(); this.props.onSelect(this.props.option, event); } render() { return React.createElement( 'div', { className: `select-option ${this.props.className}`, role: 'button', onClick: this.onClickHandler }, React.createElement( 'span', { className: 'select-option-label' }, this.props.children ) ); } } export default SelectOption; SelectOption.propTypes = { onSelect: PropTypes.func, option: PropTypes.string, className: PropTypes.string, children: PropTypes.node.isRequired }; SelectOption.defaultProps = { onSelect: f => f, option: '', className: '' }; //# sourceMappingURL=SelectOption.js.map