Files
no-copy-frontend/src/app/ui/nav-links.tsx
T

57 lines
1.0 KiB
TypeScript
Raw Normal View History

2025-11-24 18:52:32 +07:00
'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import clsx from 'clsx';
2025-11-25 17:13:16 +07:00
import styles from './ui.module.scss'
import Logo from '@/app/ui/logo';
2025-11-24 18:52:32 +07:00
const links = [
{
2025-11-25 17:13:16 +07:00
name: 'Главная',
href: '/pages/dashboard',
img: 'M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z'
2025-11-24 18:52:32 +07:00
},
{
name: 'Page1',
2025-11-25 17:13:16 +07:00
href: '/pages/page1',
img: ''
2025-11-24 18:52:32 +07:00
},
{
name: 'Page2',
2025-11-25 17:13:16 +07:00
href: '/pages/page2',
img: ''
2025-11-24 18:52:32 +07:00
}
];
export default function NavLinks() {
const pathname = usePathname();
return (
2025-11-25 17:13:16 +07:00
<div className=''>
<nav className={`${styles.sidebar}`}>
<Logo />
2025-11-24 18:52:32 +07:00
{links.map((link) => {
return (
<Link
key={link.name}
href={link.href}
className={clsx(
2025-11-25 17:13:16 +07:00
`flex ${styles['nav-item']}`,
2025-11-24 18:52:32 +07:00
{
2025-11-25 17:13:16 +07:00
'bg-[#5659f1]': pathname === link.href,
2025-11-24 18:52:32 +07:00
},
)}
>
2025-11-25 17:13:16 +07:00
<svg viewBox="0 0 24 24" fill="currentColor">
<path d={link.img}></path>
</svg>
2025-11-24 18:52:32 +07:00
<p className="hidden md:block">{link.name}</p>
</Link>
);
})}
</nav>
</div>
);
}