Skip to content

Commit

Permalink
Update block-bindings-button import to block-bindings-indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Feb 22, 2024
1 parent bbd3fcc commit 06fdbf7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { ToolbarButton } from '@wordpress/components';
import { ToolbarItem, ToolbarGroup, Icon } from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import { connection } from '@wordpress/icons';
import { _x } from '@wordpress/i18n';
Expand All @@ -11,7 +11,7 @@ import { _x } from '@wordpress/i18n';
*/
import { store as blockEditorStore } from '../../store';

export default function BlockBindingsButton( { clientId } ) {
export default function BlockBindingsIndicator( { clientId } ) {
const isConnected = useSelect(
( select ) => {
const attributes =
Expand All @@ -23,10 +23,14 @@ export default function BlockBindingsButton( { clientId } ) {
);

return isConnected ? (
<ToolbarButton
icon={ connection }
label={ _x( 'Connected', 'block toolbar button label' ) }
iconSize={ 24 }
></ToolbarButton>
<ToolbarGroup>
<ToolbarItem
as={ 'div' }
aria-label={ _x( 'Connected', 'block toolbar button label' ) }
className="block-editor-block-bindings-indicator"
>
<Icon icon={ connection } size={ 24 } />
</ToolbarItem>
</ToolbarGroup>
) : null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.block-editor-block-bindings-indicator {
display: inline-flex;
align-items: center;
height: 48px;
padding: 6px;
}
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { store as blockEditorStore } from '../../store';
import __unstableBlockNameContext from './block-name-context';
import NavigableToolbar from '../navigable-toolbar';
import { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';
import BlockBindingsButton from '../block-bindings-button';
import BlockBindingsIndicator from '../block-bindings-indicator';

/**
* Renders the block toolbar.
Expand Down Expand Up @@ -166,7 +166,7 @@ export function PrivateBlockToolbar( {
{ ! isMultiToolbar &&
isLargeViewport &&
isDefaultEditingMode && <BlockParentSelector /> }
<BlockBindingsButton clientId={ blockClientId } />
<BlockBindingsIndicator clientId={ blockClientId } />
{ ( shouldShowVisualToolbar || isMultiToolbar ) &&
isDefaultEditingMode && (
<div
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "./autocompleters/style.scss";
@import "./components/block-alignment-control/style.scss";
@import "./components/block-bindings-indicator/style.scss";
@import "./components/block-canvas/style.scss";
@import "./components/block-icon/style.scss";
@import "./components/block-inspector/style.scss";
Expand Down

0 comments on commit 06fdbf7

Please sign in to comment.