Skip to content

Commit

Permalink
Rename the component
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Jun 11, 2024
1 parent c862489 commit c702ddb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.

This file was deleted.

6 changes: 4 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 Shuffle from './shuffle';
import BlockBindingsIndicator from '../block-bindings-toolbar-indicator';
import PatternOverridesToolbarIndicator from '../pattern-overrides-toolbar-indicator';
import { useHasBlockToolbar } from './use-has-block-toolbar';
import { canBindBlock } from '../../hooks/use-bindings-attributes';
/**
Expand Down Expand Up @@ -179,7 +179,9 @@ export function PrivateBlockToolbar( {
{ isUsingBindings &&
hasParentPattern &&
canBindBlock( blockName ) && (
<BlockBindingsIndicator clientIds={ blockClientIds } />
<PatternOverridesToolbarIndicator
clientIds={ blockClientIds }
/>
) }
{ ( shouldShowVisualToolbar || isMultiToolbar ) &&
( isDefaultEditingMode || isSynced ) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ import { store as blockEditorStore } from '../../store';
import BlockIcon from '../block-icon';
import useBlockDisplayTitle from '../block-title/use-block-display-title';

export default function BlockBindingsToolbarIndicator( { clientIds } ) {
/**
* This component is currently only for pattern overrides, which is a WP-only feature.
* Ideally, this should be moved to the `patterns` package once ready.
* @param {Object} props The component props.
* @param {Array} props.clientIds The client IDs of the selected blocks.
*/
export default function PatternOverridesToolbarIndicator( { clientIds } ) {
const isSingleBlockSelected = clientIds.length === 1;
const { icon, firstBlockName } = useSelect(
( select ) => {
Expand Down Expand Up @@ -76,18 +82,18 @@ export default function BlockBindingsToolbarIndicator( { clientIds } ) {
<ToolbarItem>
{ ( toggleProps ) => (
<DropdownMenu
className="block-editor-block-bindings-toolbar-indicator"
className="block-editor-pattern-overrides-toolbar-indicator"
label={ firstBlockTitle }
popoverProps={ {
placement: 'bottom-start',
className:
'block-editor-block-bindings-toolbar-indicator__popover',
'block-editor-pattern-overrides-toolbar-indicator__popover',
} }
icon={
<>
<BlockIcon
icon={ icon }
className="block-editor-block-bindings-toolbar-indicator-icon"
className="block-editor-pattern-overrides-toolbar-indicator-icon"
showColors
/>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.block-editor-pattern-overrides-toolbar-indicator__popover .components-popover__content {
min-width: 260px;
padding: $grid-unit-20;
}

.block-editor-pattern-overrides-toolbar-indicator .block-editor-pattern-overrides-toolbar-indicator-icon.has-colors svg {
fill: var(--wp-block-synced-color);
}

.editor-collapsible-block-toolbar .block-editor-pattern-overrides-toolbar-indicator {
height: 32px;
}

0 comments on commit c702ddb

Please sign in to comment.