Spaces:
Configuration error
Configuration error
Download src/components/layout/SideNav.tsx from SreejithSHR/umami: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/layout/SideNav.tsx
- Command line
-
hf download hf://spaces/SreejithSHR/umami/src/components/layout/SideNav.tsx
-
curl -L -o SideNav.tsx https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/layout/SideNav.tsx
1.04 kB
| import classNames from 'classnames'; | |
| import { Menu, Item } from 'react-basics'; | |
| import { usePathname } from 'next/navigation'; | |
| import Link from 'next/link'; | |
| import styles from './SideNav.module.css'; | |
| export interface SideNavProps { | |
| selectedKey: string; | |
| items: any[]; | |
| shallow?: boolean; | |
| scroll?: boolean; | |
| className?: string; | |
| onSelect?: () => void; | |
| } | |
| export function SideNav({ | |
| selectedKey, | |
| items, | |
| shallow = true, | |
| scroll = false, | |
| className, | |
| onSelect = () => {}, | |
| }: SideNavProps) { | |
| const pathname = usePathname(); | |
| return ( | |
| <Menu | |
| items={items} | |
| selectedKey={selectedKey} | |
| className={classNames(styles.menu, className)} | |
| onSelect={onSelect} | |
| > | |
| {({ key, label, url }) => ( | |
| <Item | |
| key={key} | |
| className={classNames(styles.item, { [styles.selected]: pathname.startsWith(url) })} | |
| > | |
| <Link href={url} shallow={shallow} scroll={scroll}> | |
| {label} | |
| </Link> | |
| </Item> | |
| )} | |
| </Menu> | |
| ); | |
| } | |
| export default SideNav; | |