import PropTypes from 'prop-types'; import React, { Component } from 'react'; import classNames from 'classnames'; import { icons } from 'Helpers/Props'; import Icon from 'Components/Icon'; import Link from 'Components/Link/Link'; import CheckInput from './CheckInput'; import styles from './EnhancedSelectInputOption.css'; class EnhancedSelectInputOption extends Component { // // Listeners onPress = () => { const { id, onSelect } = this.props; onSelect(id); } onCheckPress = () => { // CheckInput requires a handler. Swallow the change event because onPress will already handle it via event propagation. } // // Render render() { const { className, id, depth, isSelected, isDisabled, isHidden, isMultiSelect, isMobile, children } = this.props; return ( { depth !== 0 &&
} { isMultiSelect && } {children} { isMobile &&
} ); } } EnhancedSelectInputOption.propTypes = { className: PropTypes.string.isRequired, id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, depth: PropTypes.number.isRequired, isSelected: PropTypes.bool.isRequired, isDisabled: PropTypes.bool.isRequired, isHidden: PropTypes.bool.isRequired, isMultiSelect: PropTypes.bool.isRequired, isMobile: PropTypes.bool.isRequired, children: PropTypes.node.isRequired, onSelect: PropTypes.func.isRequired }; EnhancedSelectInputOption.defaultProps = { className: styles.option, depth: 0, isDisabled: false, isHidden: false, isMultiSelect: false }; export default EnhancedSelectInputOption;