import { Link, NavLink, useNavigate } from 'react-router-dom' import { FileText, LayoutDashboard, LogOut, Moon, Sun, X } from 'lucide-react' import { logout } from '@/api/auth' import { useTheme } from '@/components/theme-provider' import { LogoMark } from '@/components/logo' import { cn } from '@/lib/utils' const NAV = [ { to: '/', label: '仪表盘', icon: LayoutDashboard, end: true }, { to: '/posts', label: '文章', icon: FileText, end: false }, ] interface Props { open: boolean onClose: () => void } export function AdminSidebar({ open, onClose }: Props) { const navigate = useNavigate() const { resolved, setTheme } = useTheme() const itemCls = ({ isActive }: { isActive: boolean }) => cn( 'flex items-center gap-3 rounded-lg px-3 py-2.5 text-[14px] transition-colors', isActive ? 'bg-accent-soft font-medium text-accent-ink' : 'text-ink-2 hover:bg-ground hover:text-ink', ) const bottomBtnCls = 'flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-[14px] text-ink-2 transition-colors hover:bg-ground hover:text-ink' return ( <> {open && (