import { Link, useLocation } from 'react-router' import { twMerge } from 'tailwind-merge' import { MENU } from './menu' export const Sidebar = () => { const { pathname } = useLocation() const path = () => { // Extract the first three segments for deep paths, otherwise use the full pathname const segments = pathname.split('/') return segments.length > 3 ? segments.slice(0, 3).join('/') : pathname } return (
{MENU.map(({ group, items }) => (
{group}
{items.map(({ title, url, icon: Icon }) => ( {title} ))}
))}
) }