mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove renderToDOM and inline the single use
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
86f6afc0c1
commit
0928d4c2b1
@ -10,7 +10,7 @@ import { createPortal } from "react-dom";
|
||||
import { observer } from "mobx-react";
|
||||
import type { IClassName } from "../../utils";
|
||||
import { cssNames, autoBind } from "../../utils";
|
||||
import { observable, makeObservable, action, computed } from "mobx";
|
||||
import { observable, makeObservable, action } from "mobx";
|
||||
|
||||
export enum TooltipPosition {
|
||||
TOP = "top",
|
||||
@ -64,10 +64,6 @@ export class Tooltip extends React.Component<TooltipProps> {
|
||||
autoBind(this);
|
||||
}
|
||||
|
||||
@computed get renderToDOM() {
|
||||
return this.props.visible ?? this.isVisible;
|
||||
}
|
||||
|
||||
get targetElem(): HTMLElement | null {
|
||||
return document.getElementById(this.props.targetId);
|
||||
}
|
||||
@ -221,11 +217,12 @@ export class Tooltip extends React.Component<TooltipProps> {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.renderToDOM) {
|
||||
const { style, formatters, usePortal, children, visible = this.isVisible } = this.props;
|
||||
|
||||
if (!visible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { style, formatters, usePortal, children } = this.props;
|
||||
const className = cssNames("Tooltip", this.props.className, formatters, this.activePosition, {
|
||||
visible: this.isContentVisible || this.props.visible,
|
||||
formatter: !!formatters,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user