import React from 'react';
import {
DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuPortal,
DropdownMenuSubContent,
DropdownMenuItem,
Icons,
} from '@ohif/ui-next';
export default {
'ohif.menuContent': function (props) {
const { item: topLevelItem, commandsManager, servicesManager, ...rest } = props;
const content = function (subProps) {
const { item: subItem } = subProps;
// Regular menu item
const isDisabled = subItem.selector && !subItem.selector({ servicesManager });
return (
{
commandsManager.runAsync(subItem.commands, {
...subItem.commandOptions,
...rest,
});
}}
className="gap-[6px]"
>
{subItem.iconName && (
)}
{subItem.label}
);
};
// If item has sub-items, render a submenu
if (topLevelItem.items) {
return (
{topLevelItem.iconName && (
)}
{topLevelItem.label}
{topLevelItem.items.map(subItem => content({ ...props, item: subItem }))}
);
}
return content({ ...props, item: topLevelItem });
},
};