-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move components out of main edit component
- Loading branch information
Showing
3 changed files
with
31 additions
and
21 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
packages/block-library/src/navigation/edit/accessible-description.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,10 @@ | ||
export default function AccessibleDescription( { id, content } ) { | ||
return ( | ||
<div | ||
id={ id } | ||
className="wp-block-navigation__description screen-reader-text" | ||
> | ||
{ content } | ||
</div> | ||
); | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/block-library/src/navigation/edit/accessible-menu-description.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,18 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useEntityProp } from '@wordpress/core-data'; | ||
import { __, sprintf } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import AccessibleDescription from './accessible-description'; | ||
|
||
export default function AccessibleMenuDescription( { id } ) { | ||
const [ menuTitle ] = useEntityProp( 'postType', 'wp_navigation', 'title' ); | ||
/* translators: %s: Title of a Navigation Menu post. */ | ||
const description = sprintf( __( `Navigation menu: "%s"` ), menuTitle ); | ||
|
||
return <AccessibleDescription id={ id } content={ description } />; | ||
} |
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