blob: 7e09e2c9c193ef893a055de832b4b393bc0ada0c [file] [log] [blame]
Krishya2e0f49a2025-05-29 10:59:01 +08001import React from 'react';
2import { Link, useLocation } from 'react-router-dom';
3import './UserNav.css'; // 导入 UserNav 样式文件
4
5const UserNav = () => {
6 const location = useLocation();
7
223010094952a0f2025-06-07 18:58:16 +08008 // 竖直导航栏的链接项
Krishya2e0f49a2025-05-29 10:59:01 +08009 const navLinks = [
10 { to: '/user/profile', label: '个人资料' },
11 { to: '/user/dynamics', label: '我的动态' },
12 { to: '/user/friends', label: '我的好友' },
Krishyadbfadaa2025-06-09 20:33:15 +080013 // { to: '/user/groups', label: '我的群组' },
Krishya2e0f49a2025-05-29 10:59:01 +080014 { to: '/user/collections', label: '我的收藏' },
223010094952a0f2025-06-07 18:58:16 +080015 // { to: '/user/newbie-tasks', label: '用户考核' },
Krishya7096ab12025-06-05 17:15:46 +080016 { to: '/user/invite', label: '邀请新用户' },
2230100901d3ff92025-06-07 16:16:26 +080017 { to: '/user/recharge', label: '充值服务' },
Krishya2e0f49a2025-05-29 10:59:01 +080018 ];
19
20 // 判断路径是否是当前活动页面
21 const isActive = (path) => location.pathname.startsWith(path);
22
23 return (
24 <div className="user-nav-container">
25 <nav className="user-nav">
26 {navLinks.map(({ to, label }) => (
27 <Link
28 key={to}
29 to={to}
30 className={`user-nav-item ${isActive(to) ? 'active' : ''}`}
31 >
32 {label}
33 </Link>
34 ))}
35 </nav>
36 </div>
37 );
38};
39
40export default UserNav;