forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove custom button and (conditionally) show single menu on Navigati…
…on route in Browse Mode (WordPress#51565) * Remove custom button and show single menu on Navigation route * Extract hooks * Pass menu to all hooks * Use SingleMenu component and hooks on Navigation listing route * Move hooks to file file * Consolidate to a single hook * Improve hooks by passing arg at call time * Rename hooks
- Loading branch information
1 parent
ea59ca6
commit 40e6e02
Showing
6 changed files
with
259 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...t-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { decodeEntities } from '@wordpress/html-entities'; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus'; | ||
import ScreenNavigationMoreMenu from './more-menu'; | ||
import NavigationMenuEditor from './navigation-menu-editor'; | ||
|
||
export default function SingleNavigationMenu( { | ||
navigationMenu, | ||
handleDelete, | ||
handleDuplicate, | ||
handleSave, | ||
} ) { | ||
const menuTitle = navigationMenu?.title?.rendered; | ||
|
||
return ( | ||
<SidebarNavigationScreenWrapper | ||
actions={ | ||
<ScreenNavigationMoreMenu | ||
menuTitle={ decodeEntities( menuTitle ) } | ||
onDelete={ handleDelete } | ||
onSave={ handleSave } | ||
onDuplicate={ handleDuplicate } | ||
/> | ||
} | ||
title={ decodeEntities( menuTitle ) } | ||
description={ __( | ||
'Navigation menus are a curated collection of blocks that allow visitors to get around your site.' | ||
) } | ||
> | ||
<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } /> | ||
</SidebarNavigationScreenWrapper> | ||
); | ||
} |
Oops, something went wrong.