'use client'; import * as React from 'react'; import RouterLink from 'next/link'; import { usePathname } from 'next/navigation'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Divider from '@mui/material/Divider'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import { ArrowSquareUpRightIcon } from '@phosphor-icons/react/dist/ssr/ArrowSquareUpRight'; import { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'; import type { NavItemConfig } from '@/types/nav'; import { paths } from '@/paths'; import { isNavItemActive } from '@/lib/is-nav-item-active'; import { Logo } from '@/components/core/logo'; import { navItems } from './config'; import { navIcons } from './nav-icons'; export function SideNav(): React.JSX.Element { const pathname = usePathname(); return ( Workspace Devias {renderNavItems({ pathname, items: navItems })}
Need more features? Check out our Pro solution template.
); } function renderNavItems({ items = [], pathname }: { items?: NavItemConfig[]; pathname: string }): React.JSX.Element { const children = items.reduce((acc: React.ReactNode[], curr: NavItemConfig): React.ReactNode[] => { const { key, ...item } = curr; acc.push(); return acc; }, []); return ( {children} ); } interface NavItemProps extends Omit { pathname: string; } function NavItem({ disabled, external, href, icon, matcher, pathname, title }: NavItemProps): React.JSX.Element { const active = isNavItemActive({ disabled, external, href, matcher, pathname }); const Icon = icon ? navIcons[icon] : null; return (
  • {Icon ? ( ) : null} {title}
  • ); }