Skip to content

Commit

Permalink
Block Editor: Try groups for InspectorControls (#34069)
Browse files Browse the repository at this point in the history
* Block Editor: Try groups for InspectorControls

* Update packages/block-editor/src/components/inspector-controls/fill.js

* Remove the `block` group in InspectorControls

* Make the group in InspectorControls experimental

* Update React Native implementation to match web
  • Loading branch information
gziolo authored Aug 23, 2021
1 parent cfc5d8b commit 9385d9c
Show file tree
Hide file tree
Showing 21 changed files with 211 additions and 374 deletions.
4 changes: 1 addition & 3 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,7 @@ Undocumented declaration.

### InspectorAdvancedControls

_Related_

- <https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-advanced-controls/README.md>
Undocumented declaration.

### InspectorControls

Expand Down
18 changes: 9 additions & 9 deletions packages/block-editor/src/components/block-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import { useSelect } from '@wordpress/data';
*/
import SkipToSelectedBlock from '../skip-to-selected-block';
import BlockCard from '../block-card';
import InspectorControls from '../inspector-controls';
import InspectorAdvancedControls from '../inspector-advanced-controls';
import {
default as InspectorControls,
InspectorAdvancedControls,
} from '../inspector-controls';
import BlockStyles from '../block-styles';
import MultiSelectionInspector from '../multi-selection-inspector';
import DefaultStylePicker from '../default-style-picker';
Expand Down Expand Up @@ -128,18 +130,15 @@ const BlockInspectorSingleBlock = ( {
) }
<InspectorControls.Slot bubblesVirtually={ bubblesVirtually } />
<div>
<AdvancedControls
slotName={ InspectorAdvancedControls.slotName }
bubblesVirtually={ bubblesVirtually }
/>
<AdvancedControls bubblesVirtually={ bubblesVirtually } />
</div>
<SkipToSelectedBlock key="back" />
</div>
);
};

const AdvancedControls = ( { slotName, bubblesVirtually } ) => {
const slot = useSlot( slotName );
const AdvancedControls = ( { bubblesVirtually } ) => {
const slot = useSlot( InspectorAdvancedControls.slotName );
const hasFills = Boolean( slot.fills && slot.fills.length );

if ( ! hasFills ) {
Expand All @@ -152,7 +151,8 @@ const AdvancedControls = ( { slotName, bubblesVirtually } ) => {
title={ __( 'Advanced' ) }
initialOpen={ false }
>
<InspectorAdvancedControls.Slot
<InspectorControls.Slot
__experimentalGroup="advanced"
bubblesVirtually={ bubblesVirtually }
/>
</PanelBody>
Expand Down
6 changes: 4 additions & 2 deletions packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ export {
default as InnerBlocks,
useInnerBlocksProps as __experimentalUseInnerBlocksProps,
} from './inner-blocks';
export { default as InspectorAdvancedControls } from './inspector-advanced-controls';
export { default as InspectorControls } from './inspector-controls';
export {
default as InspectorControls,
InspectorAdvancedControls,
} from './inspector-controls';
export {
JustifyToolbar,
JustifyContentControl,
Expand Down
6 changes: 4 additions & 2 deletions packages/block-editor/src/components/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export {
default as InnerBlocks,
useInnerBlocksProps as __experimentalUseInnerBlocksProps,
} from './inner-blocks';
export { default as InspectorAdvancedControls } from './inspector-advanced-controls';
export { default as InspectorControls } from './inspector-controls';
export {
default as InspectorControls,
InspectorAdvancedControls,
} from './inspector-controls';
export {
JustifyToolbar,
JustifyContentControl,
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9385d9c

Please sign in to comment.