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 MenuDrilldownInitialState: React.FunctionComponent = () => { const [menuDrilledIn, setMenuDrilledIn] = React.useState([ 'initial-state-rootMenu', 'initial-state-drilldownMenuStart' ]); const [drilldownPath, setDrilldownPath] = React.useState(['group:start_rollout', 'group:app_grouping']); const [menuHeights, setMenuHeights] = React.useState({ 'initial-state-rootMenu': 216 }); // The root menu height must be defined when starting from a drilled in state const [activeMenu, setActiveMenu] = React.useState('initial-state-drilldownMenuStartGrouping'); 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 !== 'initial-state-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 ); };