Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
fix: introduces FinalIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
paschalidi committed Apr 19, 2019
1 parent e556fdd commit 6ca00da
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/components/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,16 +481,20 @@ class Tooltip extends Component {

const iconProperties = { name: iconName, role: null, description: null };

const finalIcon = IconCustomElement ? (
<IconCustomElement {...iconProperties} />
) : (
<Icon
icon={!icon && !iconName ? iconInfoGlyph : icon}
iconRef={mergeRefs(ref, node => {
this.triggerEl = node;
})}
{...iconProperties}
/>
const FinalIcon = properties => (
<div className={`${prefix}--tooltip__trigger`} {...properties}>
{IconCustomElement ? (
<IconCustomElement {...iconProperties} />
) : (
<Icon
icon={!icon && !iconName ? iconInfoGlyph : icon}
iconRef={mergeRefs(ref, node => {
this.triggerEl = node;
})}
{...iconProperties}
/>
)}
</div>
);

return (
Expand All @@ -499,9 +503,7 @@ class Tooltip extends Component {
{showIcon ? (
<div id={triggerId} className={triggerClasses}>
{triggerText}
<div className={`${prefix}--tooltip__trigger`} {...properties}>
{finalIcon}
</div>
<FinalIcon {...properties} />
</div>
) : (
<div id={triggerId} className={triggerClasses} {...properties}>
Expand Down

0 comments on commit 6ca00da

Please sign in to comment.