diff --git a/public/app/core/components/Portal/BodyPortal.tsx b/public/app/core/components/Portal/Portal.tsx similarity index 72% rename from public/app/core/components/Portal/BodyPortal.tsx rename to public/app/core/components/Portal/Portal.tsx index 1c8983b9794..25d54a64209 100644 --- a/public/app/core/components/Portal/BodyPortal.tsx +++ b/public/app/core/components/Portal/Portal.tsx @@ -3,18 +3,25 @@ import ReactDOM from 'react-dom'; interface Props { className?: string; + root?: HTMLElement; } export default class BodyPortal extends PureComponent { node: HTMLElement = document.createElement('div'); - portalRoot = document.body; + portalRoot: HTMLElement; constructor(props) { super(props); - const { className } = this.props; + const { + className, + root = document.body + } = this.props; + if (className) { - this.node.classList.add(); + this.node.classList.add(className); } + + this.portalRoot = root; this.portalRoot.appendChild(this.node); } diff --git a/public/app/core/components/Tooltip/Popper.tsx b/public/app/core/components/Tooltip/Popper.tsx index d2f0e6039e4..36cf0fe837e 100644 --- a/public/app/core/components/Tooltip/Popper.tsx +++ b/public/app/core/components/Tooltip/Popper.tsx @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import BodyPortal from 'app/core/components/Portal/BodyPortal'; +import Portal from 'app/core/components/Portal/Portal'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; import Transition from 'react-transition-group/Transition'; @@ -39,7 +39,7 @@ class Popper extends PureComponent { {transitionState => ( - + {({ ref, style, placement, arrowProps }) => { return ( @@ -61,7 +61,7 @@ class Popper extends PureComponent { ); }} - + )}