import React from 'react'; import { Menu, MenuContent, MenuList, MenuItem, Divider, DrilldownMenu } from '@breakaway/preact-core'; import StorageDomainIcon from '@patternfly/react-icons/dist/esm/icons/storage-domain-icon'; import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon'; import LayerGroupIcon from '@patternfly/react-icons/dist/esm/icons/layer-group-icon'; import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon'; export const MenuWithDrilldownSubmenuFunctions: React.FunctionComponent = () => { const [menuDrilledIn, setMenuDrilledIn] = React.useState([]); const [drilldownPath, setDrilldownPath] = React.useState([]); const [menuHeights, setMenuHeights] = React.useState({}); const [activeMenu, setActiveMenu] = React.useState('functions-rootMenu'); const drillIn = ( _event: React.KeyboardEvent | React.MouseEvent, fromMenuId: string, toMenuId: string, pathId: string ) => { setMenuDrilledIn([...menuDrilledIn, fromMenuId]); setDrilldownPath([...drilldownPath, pathId]); setActiveMenu(toMenuId); }; const drillOut = (_event: React.KeyboardEvent | React.MouseEvent, toMenuId: string) => { const menuDrilledInSansLast = menuDrilledIn.slice(0, menuDrilledIn.length - 1); const pathSansLast = drilldownPath.slice(0, drilldownPath.length - 1); setMenuDrilledIn(menuDrilledInSansLast); setDrilldownPath(pathSansLast); setActiveMenu(toMenuId); }; const setHeight = (menuId: string, height: number) => { if (menuHeights[menuId] === undefined || (menuId !== 'functions-rootMenu' && menuHeights[menuId] !== height)) { setMenuHeights({ ...menuHeights, [menuId]: height }); } }; return ( ( Start rollout ( Application grouping Group A Group B Group C )} > Application grouping Count ( Labels Label 1 Label 2 Label 3 )} > Labels Annotations )} > Start rollout ( Pause rollouts ( Application grouping Group A Group B Group C )} > Application grouping Count ( Labels Label 1 Label 2 Label 3 )} > Labels Annotations )} > Pause rollouts } direction="down" drilldownMenu={() => ( } direction="up"> Add storage } itemId="git"> From git } itemId="container"> Container image } itemId="docker"> Docker file )} > Add storage Edit Delete deployment config ); };