-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 (#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
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.
4bde6ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 4bde6ab.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5321896604
📝 Reported issues:
specs/editor/various/autosave.test.js