diff --git a/packages/block-editor/src/components/block-draggable/style.scss b/packages/block-editor/src/components/block-draggable/style.scss index 437ed65a936a88..b33fced9af2ab4 100644 --- a/packages/block-editor/src/components/block-draggable/style.scss +++ b/packages/block-editor/src/components/block-draggable/style.scss @@ -8,14 +8,12 @@ .block-editor-block-draggable-chip { background-color: $gray-900; border-radius: $radius-block-ui; - border: $border-width solid $gray-900; - box-shadow: 0 4px 6px rgba($black, 0.3); + box-shadow: 0 6px 8px rgba($black, 0.3); color: $white; cursor: grabbing; display: inline-flex; height: $block-toolbar-height; - min-width: $button-size * 2; - padding: 0 $grid-unit-15; + padding: 0 ( $grid-unit-15 + $border-width ); user-select: none; svg { @@ -24,6 +22,21 @@ .block-editor-block-draggable-chip__content { margin: auto; + justify-content: flex-start; + + > .components-flex__item { + margin-right: $grid-unit-15 / 2; + + &:last-child { + margin-right: 0; + } + } + + // Drag handle is smaller than the others. + .block-editor-block-icon svg { + min-width: 18px; + min-height: 18px; + } } .components-flex__item { diff --git a/packages/block-editor/src/components/block-list/block-selection-button.js b/packages/block-editor/src/components/block-list/block-selection-button.js index 0c1c7310496635..12a6ac220d297b 100644 --- a/packages/block-editor/src/components/block-list/block-selection-button.js +++ b/packages/block-editor/src/components/block-list/block-selection-button.js @@ -6,7 +6,8 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Button } from '@wordpress/components'; +import { dragHandle } from '@wordpress/icons'; +import { Button, Flex, FlexItem } from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; import { useEffect, useRef } from '@wordpress/element'; import { @@ -27,12 +28,15 @@ import { } from '@wordpress/blocks'; import { speak } from '@wordpress/a11y'; import { focus } from '@wordpress/dom'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ import BlockTitle from '../block-title'; +import BlockIcon from '../block-icon'; import { store as blockEditorStore } from '../../store'; +import BlockDraggable from '../block-draggable'; /** * Returns true if the user is using windows. @@ -93,9 +97,12 @@ function BlockSelectionButton( { clientId, rootClientId, blockElement } ) { const { __unstableGetBlockWithoutInnerBlocks, getBlockIndex, + getBlockName, hasBlockMovingClientId, getBlockListSettings, } = select( blockEditorStore ); + const blockName = getBlockName( clientId ); + const blockType = getBlockType( blockName ); const index = getBlockIndex( clientId, rootClientId ); const { name, attributes } = __unstableGetBlockWithoutInnerBlocks( clientId @@ -107,11 +114,19 @@ function BlockSelectionButton( { clientId, rootClientId, blockElement } ) { attributes, blockMovingMode, orientation: getBlockListSettings( rootClientId )?.orientation, + icon: blockType.icon, }; }, [ clientId, rootClientId ] ); - const { index, name, attributes, blockMovingMode, orientation } = selected; + const { + index, + name, + attributes, + blockMovingMode, + orientation, + icon, + } = selected; const { setNavigationMode, removeBlock } = useDispatch( blockEditorStore ); const ref = useRef(); @@ -256,16 +271,45 @@ function BlockSelectionButton( { clientId, rootClientId, blockElement } ) { } ); + const dragHandleLabel = __( 'Drag' ); + return (