From 84dffd676493da024a71d7152fcdf6251b3b857a Mon Sep 17 00:00:00 2001 From: zetaloop Date: Wed, 25 Feb 2026 14:31:28 +0800 Subject: [PATCH] refactor(nav): unify navigation links with Button asChild pattern --- components/account-sidebar.tsx | 21 ++++++++++----------- components/dashboard-sidebar.tsx | 21 ++++++++++----------- components/header.tsx | 2 +- components/ui/button.tsx | 8 ++++---- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/components/account-sidebar.tsx b/components/account-sidebar.tsx index 8b5d36b..f25c9fa 100644 --- a/components/account-sidebar.tsx +++ b/components/account-sidebar.tsx @@ -3,6 +3,7 @@ import { Bell, CreditCard, Settings, ShieldCheck } from "lucide-react" import Link from "next/link" import { usePathname } from "next/navigation" +import { Button } from "@/components/ui/button" import { cn } from "@/lib/utils" const links = [ @@ -23,19 +24,17 @@ export function AccountSidebar() { const Icon = link.icon const isActive = pathname === link.href return ( - - - {link.label} - + + + {link.label} + + ) })} diff --git a/components/dashboard-sidebar.tsx b/components/dashboard-sidebar.tsx index 1cf025e..f498a95 100644 --- a/components/dashboard-sidebar.tsx +++ b/components/dashboard-sidebar.tsx @@ -13,6 +13,7 @@ import { } from "lucide-react" import Link from "next/link" import { usePathname } from "next/navigation" +import { Button } from "@/components/ui/button" import { cn } from "@/lib/utils" import { useAuthStore } from "@/store/auth" @@ -49,19 +50,17 @@ export function DashboardSidebar() { const Icon = link.icon const isActive = pathname === link.href return ( - - - {link.label} - + + + {link.label} + + ) })} diff --git a/components/header.tsx b/components/header.tsx index 31c1cc0..a04ba87 100644 --- a/components/header.tsx +++ b/components/header.tsx @@ -308,7 +308,7 @@ export function Header() { {isAuthenticated && (

切换身份

-
+
{availableRoles.map(([role, label]) => (