diff --git a/public/app/core/components/Tooltip/Popper.tsx b/public/app/core/components/Tooltip/Popper.tsx index 25a71c04500..69bfe2f5ff9 100644 --- a/public/app/core/components/Tooltip/Popper.tsx +++ b/public/app/core/components/Tooltip/Popper.tsx @@ -1,5 +1,18 @@ import React, { PureComponent } from 'react'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; +import Transition from 'react-transition-group/Transition'; + +const defaultTransitionStyles = { + transition: 'opacity 200ms linear', + opacity: 0, +}; + +const transitionStyles = { + exited: { opacity: 0 }, + entering: { opacity: 0 }, + entered: { opacity: 1 }, + exiting: { opacity: 0 }, +}; interface Props { renderContent: (content: any) => any; @@ -13,6 +26,7 @@ class Popper extends PureComponent { render() { const { children, renderContent, show, placement, refClassName } = this.props; const { content } = this.props; + return ( @@ -22,20 +36,31 @@ class Popper extends PureComponent { )} - {show && ( - - {({ ref, style, placement, arrowProps }) => { - return ( -
-
- {renderContent(content)} -
+ + {transitionState => ( + + {({ ref, style, placement, arrowProps }) => { + return ( +
+
+ {renderContent(content)} +
+
-
- ); - }} -
- )} + ); + }} + + )} +
); }