From 082f718649b1942ba29cd1a94b652c251e4631aa Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 12 Dec 2023 16:28:08 +1100 Subject: [PATCH] Make chip transparent when dragging over undroppable area. --- .../block-draggable/draggable-chip.js | 5 ++++- .../src/components/block-draggable/index.js | 18 ++++++++++++++++-- .../src/components/block-draggable/style.scss | 8 ++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/block-draggable/draggable-chip.js b/packages/block-editor/src/components/block-draggable/draggable-chip.js index d7d053be179fa..3035346864552 100644 --- a/packages/block-editor/src/components/block-draggable/draggable-chip.js +++ b/packages/block-editor/src/components/block-draggable/draggable-chip.js @@ -13,7 +13,10 @@ import BlockIcon from '../block-icon'; export default function BlockDraggableChip( { count, icon, isPattern } ) { const patternLabel = isPattern && __( 'Pattern' ); return ( -
+
} + isValid={ isDropTargetValid } > { ( { onDraggableStart, onDraggableEnd } ) => { return children( { diff --git a/packages/block-editor/src/components/block-draggable/style.scss b/packages/block-editor/src/components/block-draggable/style.scss index a27d4c4caf2f2..210e6c9dd9d67 100644 --- a/packages/block-editor/src/components/block-draggable/style.scss +++ b/packages/block-editor/src/components/block-draggable/style.scss @@ -45,3 +45,11 @@ font-size: $default-font-size; } } + +:root { + --wp--block-draggable-valid-opacity: 1; +} + +.block-draggable-invalid-drag-token { + --wp--block-draggable-valid-opacity: 0.6; +}