style(tabs): conditionally render indicator span in TabsList component

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-05-08 14:14:02 +08:00
parent 43db7a5713
commit beeda2a7a0
@@ -68,19 +68,20 @@ const TabsList = ({
)}
>
{props.children}
<span
className={cn(
"absolute left-0 duration-200 will-change-[transform,width]",
variant === "rounded"
? "bg-material-medium group-hover:bg-theme-item-hover inset-0 z-0 h-full rounded-lg"
: "bg-accent bottom-0 h-0.5 rounded",
)}
style={{
width: indicator?.w,
transform: `translate3d(${indicator?.x}px, 0, 0)`,
}}
/>
{indicator && (
<span
className={cn(
"absolute left-0 duration-200 will-change-[transform,width]",
variant === "rounded"
? "bg-material-medium group-hover:bg-theme-item-hover inset-0 z-0 h-full rounded-lg"
: "bg-accent bottom-0 h-0.5 rounded",
)}
style={{
width: indicator.w,
transform: `translate3d(${indicator.x}px, 0, 0)`,
}}
/>
)}
</TabsPrimitive.List>
)
}