()
| 5 | import {usePathname} from "next/navigation"; |
| 6 | |
| 7 | export default function SideMenu() { |
| 8 | const pathname = usePathname(); |
| 9 | |
| 10 | const navLinks = [ |
| 11 | {key: 'home', icon: HomeIcon, text: 'Home', href: '/'}, |
| 12 | {key: 'questions', icon: QuestionMarkCircleIcon, text: 'Questions', href: '/questions'}, |
| 13 | {key: 'tags', icon: TagIcon, text: 'Tags', href: '/tags'}, |
| 14 | {key: 'session', icon: UserIcon, text: 'User session', href: '/session'}, |
| 15 | {key: 'profiles', icon: UserGroupIcon, text: 'Profiles', href: '/profiles'}, |
| 16 | ]; |
| 17 | |
| 18 | const selectedKey = |
| 19 | navLinks.find(link => link.href === pathname)?.key ?? null; |
| 20 | |
| 21 | return ( |
| 22 | <Listbox |
| 23 | aria-label='nav links' |
| 24 | variant='faded' |
| 25 | items={navLinks} |
| 26 | className='sticky top-20 ml-6' |
| 27 | selectionMode="single" |
| 28 | selectedKeys={selectedKey ? [selectedKey] : []} |
| 29 | itemClasses={{ |
| 30 | base: 'data-[selected=true]:text-secondary', |
| 31 | title: 'text-lg' |
| 32 | }} |
| 33 | > |
| 34 | {({key, href, icon: Icon, text}) => ( |
| 35 | <ListboxItem |
| 36 | href={href} |
| 37 | aria-labelledby={key} |
| 38 | aria-describedby={text} |
| 39 | key={key} |
| 40 | startContent={<Icon className='h-6'/>} |
| 41 | > |
| 42 | {text} |
| 43 | </ListboxItem> |
| 44 | )} |
| 45 | </Listbox> |
| 46 | ); |
| 47 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…