import React from 'react'; import PropTypes from 'prop-types'; import { Tooltip } from 'reactstrap'; import Icon from './icon'; const propTypes = { id: PropTypes.string.isRequired, icon: PropTypes.string.isRequired, text: PropTypes.string.isRequired, onClick: PropTypes.func, href: PropTypes.string }; class IconButton extends React.Component { constructor(props) { super(props); this.state = { tooltipOpen: false }; } toggle = () => { this.setState({ tooltipOpen: !this.state.tooltipOpen }); }; render() { const btnContent = ( <> {this.props.text} ); if (this.props.href) { return (
window.open(this.props.href, '_parent')} > {btnContent}
); } else { return (
{btnContent}
); } } } IconButton.propTypes = propTypes; export default IconButton;