import {
Column,
Heading,
IconLabel,
NavMenu,
NavMenuGroup,
NavMenuItem,
type NavMenuProps,
Row,
} from '@umami/react-zen';
import Link from 'next/link';
interface SideMenuData {
id: string;
label: string;
icon?: any;
path: string;
}
interface SideMenuItems {
label?: string;
items: SideMenuData[];
}
export interface SideMenuProps extends NavMenuProps {
items: SideMenuItems[];
title?: string;
selectedKey?: string;
allowMinimize?: boolean;
}
export function SideMenu({
items = [],
title,
selectedKey,
allowMinimize,
...props
}: SideMenuProps) {
const renderItems = (items: SideMenuData[]) => {
return items?.map(({ id, label, icon, path }) => {
const isSelected = selectedKey === id;
return (
{label}
);
});
};
return (
{title && (
{title}
)}
{items?.map(({ label, items }, index) => {
if (label) {
return (
{renderItems(items)}
);
}
return null;
})}
);
}