Skip to content

Commit

Permalink
Hide classic Menus from dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Dec 17, 2021
1 parent 07ccae4 commit b4a7621
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions packages/block-library/src/navigation/edit/placeholder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ExistingMenusDropdown = ( {
onFinish,
menus,
onCreateFromMenu,
canUserCreateNavigation = false,
} ) => {
const toggleProps = {
variant: 'tertiary',
Expand Down Expand Up @@ -65,22 +66,24 @@ const ExistingMenusDropdown = ( {
);
} ) }
</MenuGroup>
<MenuGroup label={ __( 'Classic Menus' ) }>
{ menus?.map( ( menu ) => {
return (
<MenuItem
onClick={ () => {
setSelectedMenu( menu.id );
onCreateFromMenu( menu.name );
} }
onClose={ onClose }
key={ menu.id }
>
{ decodeEntities( menu.name ) }
</MenuItem>
);
} ) }
</MenuGroup>
{ canUserCreateNavigation && (
<MenuGroup label={ __( 'Classic Menus' ) }>
{ menus?.map( ( menu ) => {
return (
<MenuItem
onClick={ () => {
setSelectedMenu( menu.id );
onCreateFromMenu( menu.name );
} }
onClose={ onClose }
key={ menu.id }
>
{ decodeEntities( menu.name ) }
</MenuItem>
);
} ) }
</MenuGroup>
) }
</>
) }
</DropdownMenu>
Expand Down Expand Up @@ -195,6 +198,9 @@ export default function NavigationPlaceholder( {
onFinish={ onFinish }
menus={ menus }
onCreateFromMenu={ onCreateFromMenu }
canUserCreateNavigation={
canUserCreateNavigation
}
/>
<hr />
</>
Expand Down

0 comments on commit b4a7621

Please sign in to comment.