Allow Tooltip factory to use string native components
parent
a8e1bb7668
commit
b3f99348d4
|
@ -193,6 +193,8 @@ const tooltipFactory = (options = {}) => {
|
|||
[theme[positionClass]]: theme[positionClass]
|
||||
});
|
||||
|
||||
const isNative = typeof ComposedComponent === 'string';
|
||||
|
||||
return (
|
||||
<ComposedComponent
|
||||
{...other}
|
||||
|
@ -200,7 +202,7 @@ const tooltipFactory = (options = {}) => {
|
|||
onClick={this.handleClick}
|
||||
onMouseEnter={this.handleMouseEnter}
|
||||
onMouseLeave={this.handleMouseLeave}
|
||||
theme={theme}
|
||||
{...isNative ? {} : {theme}}
|
||||
>
|
||||
{children ? children : null}
|
||||
{visible && (
|
||||
|
|
|
@ -9,6 +9,7 @@ const TooltipStrong = Tooltip(({children, ...other}) => {
|
|||
delete other.theme;
|
||||
return <strong {...other}>{children}</strong>;
|
||||
});
|
||||
const TooltipStrongDirect = Tooltip('strong');
|
||||
|
||||
const TooltipTest = () => (
|
||||
<section>
|
||||
|
@ -27,9 +28,9 @@ const TooltipTest = () => (
|
|||
<p>
|
||||
Click this next word to show and hide on click:
|
||||
{' '}
|
||||
<TooltipStrong tooltip='This is a auto show tooltip' tooltipShowOnClick>
|
||||
<TooltipStrongDirect tooltip='This is a auto show tooltip' tooltipShowOnClick>
|
||||
oh hai
|
||||
</TooltipStrong>
|
||||
</TooltipStrongDirect>
|
||||
{' '}. This is useful for mobile!
|
||||
</p>
|
||||
</section>
|
||||
|
|
Loading…
Reference in New Issue