import { useMemo } from "react"; export type MenuProps = { items: MenuItem[]; basename?: string; }; export type MenuItem = { id: string; data: { title: string; tags: string[]; hideInMenu?: boolean; } } export const Menu = (props: MenuProps) => { const { items, basename = '' } = props; const list = useMemo(() => { return items.filter(item => !item.data?.hideInMenu).sort((a, b) => { return (a.id).localeCompare(b.id) }); }, [items]); if (list.length === 0) { return null; } const currentPath = typeof window !== 'undefined' ? window.location.pathname : ''; const isActive = (itemId: string) => { return currentPath.includes(`/docs/${itemId}`); }; return ( ); }