import { MenuItem } from '@difizen/mana-core'; import { useInject } from '@difizen/mana-observable'; import { Menubar } from '@difizen/mana-react'; import type { FC } from 'react'; import React from 'react'; import type { Menu } from './menu'; import type { MenuFactory } from './menu'; import { MenuItemRender } from './menu-item-render'; import type { MenuItemRenderProps } from './menu-protocol'; import { MenuInstance } from './menu-protocol'; import { MenuRender } from './menu-render'; const MenuBarItemRender: FC = (props: MenuItemRenderProps) => { const { item, root } = props; const menu = useInject(MenuInstance); let children: MenuItem[] = []; if (MenuItem.isGeneralMenuItem(item)) { children = item.children; } if (root) { return ( {children.sort(menu.sort).map((child) => { if (MenuItem.isGeneralMenuItem(child)) { return ( {menu.renderMenuList(child.children)} ); } return ; })} ); } else { return ; } }; export interface MenuBarRenderProps { data?: any[]; menuPath: any; factory?: MenuFactory; menu?: Menu; } export const MenuBarRender = React.memo(function MenuBarRender( props: MenuBarRenderProps, ) { return ; });