import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { Popover, OverlayTrigger } from 'patternfly-react'; import './OptionTooltip.scss'; class OptionTooltip extends Component { constructor(props) { super(props); this.state = { tooltipOpen: false, }; this.handleInputChange = this.handleInputChange.bind(this); this.renderTooltip = this.renderTooltip.bind(this); } handleInputChange(event, index) { const { options } = this.props; options[index].value = event.target.checked; this.setState(options); this.props.onChange(options); } renderTooltip() { const { options, id } = this.props; return ( ); } render() { const { icon, options, rootClose } = this.props; const onOpen = () => { this.setState({ tooltipOpen: true }); }; const onClose = () => { this.props.onClose(options); this.setState({ tooltipOpen: false }); }; return ( ); } } OptionTooltip.propTypes = { icon: PropTypes.string.isRequired, id: PropTypes.string.isRequired, options: PropTypes.arrayOf(PropTypes.shape({ key: PropTypes.string, label: PropTypes.string, value: PropTypes.bool, })).isRequired, onChange: PropTypes.func, onClose: PropTypes.func, rootClose: PropTypes.bool, }; OptionTooltip.defaultProps = { onChange: () => {}, onClose: () => {}, rootClose: true, }; export default OptionTooltip;