mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
24 lines
722 B
JavaScript
24 lines
722 B
JavaScript
import classNames from 'classnames';
|
|
import { Menu, Item } from 'react-basics';
|
|
import { useRouter } from 'next/router';
|
|
import Link from 'next/link';
|
|
import styles from './SideNav.module.css';
|
|
|
|
export default function SideNav({ selectedKey, items, shallow, onSelect = () => {} }) {
|
|
const { asPath } = useRouter();
|
|
return (
|
|
<Menu items={items} selectedKey={selectedKey} className={styles.menu} onSelect={onSelect}>
|
|
{({ key, label, url }) => (
|
|
<Item
|
|
key={key}
|
|
className={classNames(styles.item, { [styles.selected]: asPath.startsWith(url) })}
|
|
>
|
|
<Link href={url} shallow={shallow}>
|
|
{label}
|
|
</Link>
|
|
</Item>
|
|
)}
|
|
</Menu>
|
|
);
|
|
}
|