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

Version Path
katello-4.14.2 webpack/components/TooltipButton/TooltipButton.js
katello-4.15.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.15.0.rc2 webpack/components/TooltipButton/TooltipButton.js
katello-4.15.0.rc1 webpack/components/TooltipButton/TooltipButton.js
katello-4.14.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.14.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.14.0.rc3 webpack/components/TooltipButton/TooltipButton.js
katello-4.14.0.rc2 webpack/components/TooltipButton/TooltipButton.js
katello-4.14.0.rc1.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.14.0.rc1 webpack/components/TooltipButton/TooltipButton.js
katello-4.13.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.13.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.12.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.13.0.rc1 webpack/components/TooltipButton/TooltipButton.js
katello-4.12.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.12.0.rc3 webpack/components/TooltipButton/TooltipButton.js
katello-4.12.0.rc2 webpack/components/TooltipButton/TooltipButton.js
katello-4.12.0.rc1 webpack/components/TooltipButton/TooltipButton.js
katello-4.11.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.11.0 webpack/components/TooltipButton/TooltipButton.js