mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-09 20:35:28 +02:00
more tweaks to layout
This commit is contained in:
parent
b731a50cc9
commit
8b0c30f19f
22 changed files with 172 additions and 193 deletions
|
@ -17,12 +17,14 @@ export interface SidebarNavItem {
|
|||
export interface SidebarNavProps extends React.HTMLAttributes<HTMLElement> {
|
||||
items: SidebarNavItem[];
|
||||
disabled?: boolean;
|
||||
onItemClick?: () => void;
|
||||
}
|
||||
|
||||
export function SidebarNav({
|
||||
className,
|
||||
items,
|
||||
disabled = false,
|
||||
onItemClick,
|
||||
...props
|
||||
}: SidebarNavProps) {
|
||||
const pathname = usePathname();
|
||||
|
@ -87,13 +89,19 @@ export function SidebarNav({
|
|||
<Link
|
||||
href={hydratedHref}
|
||||
className={cn(
|
||||
"flex items-center py-2 px-3 w-full transition-colors",
|
||||
"flex items-center py-1 w-full transition-colors",
|
||||
isActive
|
||||
? "text-primary font-medium"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
disabled && "cursor-not-allowed opacity-60"
|
||||
)}
|
||||
onClick={disabled ? (e) => e.preventDefault() : undefined}
|
||||
onClick={(e) => {
|
||||
if (disabled) {
|
||||
e.preventDefault();
|
||||
} else if (onItemClick) {
|
||||
onItemClick();
|
||||
}
|
||||
}}
|
||||
tabIndex={disabled ? -1 : undefined}
|
||||
aria-disabled={disabled}
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue