Sha256: 98cf9d096d8dc022ed5608f2990f594534fffecbcac096ff08dd0d2a1604364c
Contents?: true
Size: 1.06 KB
Versions: 156
Compression:
Stored size: 1.06 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { Button, Tooltip, OverlayTrigger } from 'patternfly-react'; import './TooltipButton.scss'; const TooltipButton = ({ disabled, title, tooltipText, tooltipId, tooltipPlacement, renderedButton, ...props }) => { if (!disabled) return renderedButton || (<Button {...props}>{title}</Button>); return ( <OverlayTrigger placement={tooltipPlacement} delayHide={150} overlay={<Tooltip id={tooltipId}>{tooltipText}</Tooltip>} > <div className="tooltip-button-helper"> {renderedButton || (<Button {...props} disabled>{title}</Button>)} </div> </OverlayTrigger> ); }; TooltipButton.propTypes = { disabled: PropTypes.bool, title: PropTypes.string, tooltipText: PropTypes.string, tooltipId: PropTypes.string.isRequired, tooltipPlacement: PropTypes.string, renderedButton: PropTypes.node, }; TooltipButton.defaultProps = { disabled: false, title: '', tooltipPlacement: 'bottom', tooltipText: '', renderedButton: null, }; export default TooltipButton;
Version data entries
156 entries across 156 versions & 1 rubygems