Files
cunkebao_v3/nkebao/src/components/BottomNav.tsx
2025-07-04 16:11:02 +08:00

38 lines
1.2 KiB
TypeScript

import React from 'react';
import { Link, useLocation } from 'react-router-dom';
import { Home, Users, User, Briefcase } from 'lucide-react';
const navItems = [
{ href: "/", icon: Home, label: "首页" },
{ href: "/scenarios", icon: Users, label: "场景获客" },
{ href: "/workspace", icon: Briefcase, label: "工作台" },
{ href: "/profile", icon: User, label: "我的" },
];
export default function BottomNav() {
const location = useLocation();
return (
<nav className="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 z-50 h-16">
<div className="w-full h-full mx-auto flex justify-around items-center">
{navItems.map((item) => {
const IconComponent = item.icon;
const isActive = location.pathname === item.href;
return (
<Link
key={item.href}
to={item.href}
className={`flex flex-col items-center justify-center py-2 px-3 h-full ${
isActive ? "text-blue-500" : "text-gray-500"
}`}
>
<IconComponent className="w-6 h-6" />
<span className="text-xs mt-1">{item.label}</span>
</Link>
);
})}
</div>
</nav>
);
}