Fixed ShadTooltip appearing when Accordion is not disabled
This commit is contained in:
parent
50e44c674b
commit
55fdebe3bb
2 changed files with 7 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ export default function ShadTooltip({
|
||||||
styleClasses,
|
styleClasses,
|
||||||
delayDuration = 500,
|
delayDuration = 500,
|
||||||
}: ShadToolTipType): JSX.Element {
|
}: ShadToolTipType): JSX.Element {
|
||||||
return (
|
return content ? (
|
||||||
<Tooltip defaultOpen={!children} delayDuration={delayDuration}>
|
<Tooltip defaultOpen={!children} delayDuration={delayDuration}>
|
||||||
<TooltipTrigger asChild={asChild}>{children}</TooltipTrigger>
|
<TooltipTrigger asChild={asChild}>{children}</TooltipTrigger>
|
||||||
<TooltipContent
|
<TooltipContent
|
||||||
|
|
@ -22,5 +22,7 @@ export default function ShadTooltip({
|
||||||
{content}
|
{content}
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
<>{children}</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,19 +34,19 @@ const AccordionTrigger = React.forwardRef<
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex flex-1 cursor-pointer items-center justify-between py-4 text-sm font-medium transition-all [&[data-state=open]>svg]:rotate-180",
|
"flex flex-1 cursor-pointer items-center justify-between py-4 text-sm font-medium transition-all [&[data-state=open]>svg]:rotate-180",
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
styleClasses="z-50"
|
styleClasses="z-50"
|
||||||
content={disabled ? "Empty" : ""}
|
content={disabled ? "Empty" : undefined}
|
||||||
side="top"
|
side="top"
|
||||||
>
|
>
|
||||||
<ChevronDownIcon
|
<ChevronDownIcon
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-4 w-4 font-bold transition-transform duration-200",
|
"h-4 w-4 font-bold transition-transform duration-200",
|
||||||
disabled ? "text-muted-foreground" : "text-primary"
|
disabled ? "text-muted-foreground" : "text-primary",
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
|
|
@ -64,7 +64,7 @@ const AccordionContent = React.forwardRef<
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue