Update nesting of Button and Link components

The Link component is modified to be nested within the Button component in various JSX files. This change was made with the aid of the 'asChild' property, it ensures that the link remains operable even when wrapped by the button, improving the site's semantics and accessibility.
This commit is contained in:
giancarlo
2024-04-25 10:57:56 +07:00
parent 944197b84a
commit 19332d124d
12 changed files with 63 additions and 61 deletions

View File

@@ -164,14 +164,15 @@ export function SidebarItem({
const size = collapsed ? 'icon' : 'sm';
return (
<Link key={path} href={path}>
<Button
className={cn('flex w-full text-sm shadow-none', {
'justify-start space-x-2': !collapsed,
})}
size={size}
variant={variant}
>
<Button
asChild
className={cn('flex w-full text-sm shadow-none', {
'justify-start space-x-2': !collapsed,
})}
size={size}
variant={variant}
>
<Link key={path} href={path}>
<If condition={collapsed} fallback={Icon}>
<TooltipProvider>
<Tooltip>
@@ -185,8 +186,8 @@ export function SidebarItem({
</If>
<span className={cn({ hidden: collapsed })}>{children}</span>
</Button>
</Link>
</Link>
</Button>
);
}