Skip to content

Commit

Permalink
Address feedback left in review
Browse files Browse the repository at this point in the history
Props to @youknowriad.
  • Loading branch information
gziolo committed Feb 18, 2021
1 parent 54708a4 commit 21a4059
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ import { ComplementaryAreaMoreMenuItem } from '@wordpress/interface';
export default function PluginSidebarMoreMenuItem( props ) {
return (
<ComplementaryAreaMoreMenuItem
__unstableInitSource="plugin"
// Menu item is marked with unstable prop for backward compatibility.
// @see https://github.com/WordPress/gutenberg/issues/14457
__unstableExplicitMenuItem
scope="core/edit-post"
{ ...props }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export default function PluginSidebarEditPost( { className, ...props } ) {
} );
return (
<ComplementaryArea
__unstableInitSource="sidebar"
panelClassName={ className }
className="edit-post-sidebar"
smallScreenTitle={ postTitle || __( '(no title)' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const SettingsSidebar = () => {

return (
<PluginSidebarEditPost
__unstableInitSource="core"
identifier={ sidebarName }
header={ <SettingsHeader sidebarName={ sidebarName } /> }
closeLabel={ __( 'Close settings' ) }
Expand Down
9 changes: 3 additions & 6 deletions packages/interface/src/components/action-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,16 @@ function ActionItemSlot( {
Children.forEach(
fills,
( {
props: { __unstableInitSource, __unstableTarget },
props: { __unstableExplicitMenuItem, __unstableTarget },
} ) => {
if (
__unstableTarget &&
__unstableInitSource === 'plugin'
) {
if ( __unstableTarget && __unstableExplicitMenuItem ) {
initializedByPlugins.push( __unstableTarget );
}
}
);
const children = Children.map( fills, ( child ) => {
if (
child.props.__unstableInitSource === 'sidebar' &&
! child.props.__unstableExplicitMenuItem &&
initializedByPlugins.includes(
child.props.__unstableTarget
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import ActionItem from '../action-item';
export default function ComplementaryAreaMoreMenuItem( {
scope,
target,
__unstableInitSource,
__unstableExplicitMenuItem,
...props
} ) {
return (
<ComplementaryAreaToggle
as={ ( toggleProps ) => {
return (
<ActionItem
__unstableInitSource={ __unstableInitSource }
__unstableExplicitMenuItem={
__unstableExplicitMenuItem
}
__unstableTarget={ `${ scope }/${ target }` }
name={ `${ scope }/plugin-more-menu` }
{ ...toggleProps }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function ComplementaryArea( {
toggleShortcut,
isActiveByDefault,
showIconLabels = false,
__unstableInitSource,
} ) {
const { isActive, isPinned, activeArea, isSmall, isLarge } = useSelect(
( select ) => {
Expand Down Expand Up @@ -155,9 +154,8 @@ function ComplementaryArea( {
) }
</PinnedItems>
) }
{ __unstableInitSource !== 'core' && isPinnable && (
{ name && isPinnable && (
<ComplementaryAreaMoreMenuItem
__unstableInitSource={ __unstableInitSource }
target={ name }
scope={ scope }
icon={ icon }
Expand Down

0 comments on commit 21a4059

Please sign in to comment.