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 { cn } from "../../utils/utils";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipContentWithoutPortal,
|
||||
TooltipTrigger,
|
||||
} from "../ui/tooltip";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
||||
|
||||
export default function ShadTooltip({
|
||||
content,
|
||||
|
|
@ -13,23 +8,19 @@ export default function ShadTooltip({
|
|||
asChild = true,
|
||||
children,
|
||||
styleClasses,
|
||||
portal = true,
|
||||
delayDuration = 500,
|
||||
}: ShadToolTipType): JSX.Element {
|
||||
const TooltipContentComponent = portal
|
||||
? TooltipContent
|
||||
: TooltipContentWithoutPortal;
|
||||
return (
|
||||
<Tooltip delayDuration={delayDuration}>
|
||||
<TooltipTrigger asChild={asChild}>{children}</TooltipTrigger>
|
||||
<TooltipContentComponent
|
||||
<TooltipContent
|
||||
className={cn(styleClasses, "max-w-96")}
|
||||
side={side}
|
||||
avoidCollisions={false}
|
||||
sticky="always"
|
||||
>
|
||||
{content}
|
||||
</TooltipContentComponent>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ const EditNodeModal = forwardRef(
|
|||
>
|
||||
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
||||
<ShadTooltip
|
||||
portal={false}
|
||||
styleClasses="z-50"
|
||||
content={
|
||||
myData.node?.template[templateParam].proxy
|
||||
? myData.node?.template[templateParam]
|
||||
|
|
@ -223,7 +223,7 @@ const EditNodeModal = forwardRef(
|
|||
</TableCell>
|
||||
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
||||
<ShadTooltip
|
||||
portal={false}
|
||||
styleClasses="z-50"
|
||||
content={
|
||||
data.node?.template[templateParam]?.info ??
|
||||
null
|
||||
|
|
|
|||
|
|
@ -242,7 +242,6 @@ export type ShadToolTipType = {
|
|||
asChild?: boolean;
|
||||
children?: ReactElement;
|
||||
delayDuration?: number;
|
||||
portal?: boolean;
|
||||
styleClasses?: string;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue