34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { usePathname } from "next/navigation";
|
|
import { Bell, CalendarDays, ClipboardList, Home, UserRound } from "lucide-react";
|
|
|
|
const items = [
|
|
{ href: "/dashboard", label: "工作台", icon: Home },
|
|
{ href: "/tasks", label: "任务", icon: ClipboardList },
|
|
{ href: "/schedule", label: "排班", icon: CalendarDays },
|
|
{ href: "/announcements", label: "公告", icon: Bell },
|
|
{ href: "/me", label: "我的", icon: UserRound }
|
|
] as const;
|
|
|
|
export function BottomNav() {
|
|
const pathname = usePathname();
|
|
|
|
return (
|
|
<nav className="bottom-nav" aria-label="主要导航">
|
|
{items.map((item) => {
|
|
const Icon = item.icon;
|
|
const active = pathname === item.href || pathname.startsWith(`${item.href}/`);
|
|
|
|
return (
|
|
<Link className={`bottom-nav__item${active ? " is-active" : ""}`} href={item.href} key={item.href}>
|
|
<Icon aria-hidden size={20} strokeWidth={active ? 2.6 : 2} />
|
|
<span>{item.label}</span>
|
|
</Link>
|
|
);
|
|
})}
|
|
</nav>
|
|
);
|
|
}
|