Fixed tooltip that does not need removal of portal
This commit is contained in:
parent
06a568f114
commit
cbe2a8ad75
3 changed files with 5 additions and 15 deletions
|
|
@ -1,11 +1,6 @@
|
||||||
import { ShadToolTipType } from "../../types/components";
|
import { ShadToolTipType } from "../../types/components";
|
||||||
import { cn } from "../../utils/utils";
|
import { cn } from "../../utils/utils";
|
||||||
import {
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
||||||
Tooltip,
|
|
||||||
TooltipContent,
|
|
||||||
TooltipContentWithoutPortal,
|
|
||||||
TooltipTrigger,
|
|
||||||
} from "../ui/tooltip";
|
|
||||||
|
|
||||||
export default function ShadTooltip({
|
export default function ShadTooltip({
|
||||||
content,
|
content,
|
||||||
|
|
@ -13,23 +8,19 @@ export default function ShadTooltip({
|
||||||
asChild = true,
|
asChild = true,
|
||||||
children,
|
children,
|
||||||
styleClasses,
|
styleClasses,
|
||||||
portal = true,
|
|
||||||
delayDuration = 500,
|
delayDuration = 500,
|
||||||
}: ShadToolTipType): JSX.Element {
|
}: ShadToolTipType): JSX.Element {
|
||||||
const TooltipContentComponent = portal
|
|
||||||
? TooltipContent
|
|
||||||
: TooltipContentWithoutPortal;
|
|
||||||
return (
|
return (
|
||||||
<Tooltip delayDuration={delayDuration}>
|
<Tooltip delayDuration={delayDuration}>
|
||||||
<TooltipTrigger asChild={asChild}>{children}</TooltipTrigger>
|
<TooltipTrigger asChild={asChild}>{children}</TooltipTrigger>
|
||||||
<TooltipContentComponent
|
<TooltipContent
|
||||||
className={cn(styleClasses, "max-w-96")}
|
className={cn(styleClasses, "max-w-96")}
|
||||||
side={side}
|
side={side}
|
||||||
avoidCollisions={false}
|
avoidCollisions={false}
|
||||||
sticky="always"
|
sticky="always"
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</TooltipContentComponent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ const EditNodeModal = forwardRef(
|
||||||
>
|
>
|
||||||
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
portal={false}
|
styleClasses="z-50"
|
||||||
content={
|
content={
|
||||||
myData.node?.template[templateParam].proxy
|
myData.node?.template[templateParam].proxy
|
||||||
? myData.node?.template[templateParam]
|
? myData.node?.template[templateParam]
|
||||||
|
|
@ -223,7 +223,7 @@ const EditNodeModal = forwardRef(
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
portal={false}
|
styleClasses="z-50"
|
||||||
content={
|
content={
|
||||||
data.node?.template[templateParam]?.info ??
|
data.node?.template[templateParam]?.info ??
|
||||||
null
|
null
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,6 @@ export type ShadToolTipType = {
|
||||||
asChild?: boolean;
|
asChild?: boolean;
|
||||||
children?: ReactElement;
|
children?: ReactElement;
|
||||||
delayDuration?: number;
|
delayDuration?: number;
|
||||||
portal?: boolean;
|
|
||||||
styleClasses?: string;
|
styleClasses?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue