Skip to content
Snippets Groups Projects
Commit c2fe4851 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #2512 from metabase/labels-tooltip

Labels tooltip
parents 440ce0ac 26055e93
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@ import ReactDOM from "react-dom";
import { isObscured } from "metabase/lib/dom";
import Tooltip from "./Tooltip.jsx";
import cx from "classnames";
// higher order component that takes a component which takes props "isOpen" and optionally "onClose"
......@@ -87,8 +89,13 @@ export default ComposedComponent => class extends Component {
}
render() {
const { triggerElement, triggerClasses, triggerClassesOpen } = this.props;
const { triggerClasses, triggerClassesOpen } = this.props;
const { isOpen } = this.state;
let { triggerElement } = this.props;
if (triggerElement && triggerElement.type === Tooltip) {
// Disables tooltip when open:
triggerElement = React.cloneElement(triggerElement, { isEnabled: triggerElement.props.isEnabled && !isOpen });
}
return (
<a ref="trigger" onClick={() => this.toggle()} className={cx("no-decoration", triggerClasses, isOpen ? triggerClassesOpen : null)}>
{triggerElement}
......
......@@ -33,7 +33,11 @@ const Item = ({ id, name, created, by, selected, favorite, archived, icon, label
{ !archived ?
<div className={S.rightIcons}>
<LabelPopover
triggerElement={<Icon className={S.tagIcon} name="label" width={20} height={20} />}
triggerElement={
<Tooltip tooltip={"Labels"}>
<Icon className={S.tagIcon} name="label" width={20} height={20} />
</Tooltip>
}
triggerClasses={S.trigger}
triggerClassesOpen={S.open}
item={{ id, labels }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment