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.4.2.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.4.2 webpack/components/TooltipButton/TooltipButton.js
katello-4.5.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.6.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.6.0.rc2 webpack/components/TooltipButton/TooltipButton.js
katello-4.6.0.rc1 webpack/components/TooltipButton/TooltipButton.js
katello-4.5.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.5.0.rc2 webpack/components/TooltipButton/TooltipButton.js
katello-4.4.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.5.0.rc1 webpack/components/TooltipButton/TooltipButton.js
katello-4.4.0.2 webpack/components/TooltipButton/TooltipButton.js
katello-4.4.0.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.3.1 webpack/components/TooltipButton/TooltipButton.js
katello-4.4.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.4.0.rc2 webpack/components/TooltipButton/TooltipButton.js
katello-4.4.0.rc1 webpack/components/TooltipButton/TooltipButton.js
katello-4.2.2 webpack/components/TooltipButton/TooltipButton.js
katello-4.3.0 webpack/components/TooltipButton/TooltipButton.js
katello-4.3.0.rc4 webpack/components/TooltipButton/TooltipButton.js
katello-4.3.0.rc3 webpack/components/TooltipButton/TooltipButton.js