From 04d69dde75a6c6a305b5b89c4adf2621f7b9c600 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Wed, 14 Dec 2022 17:30:42 +0000 Subject: [PATCH] Page List: Update the icon to demonstrate that the pages are automatically updated (#46438) * Page List: Update the icon to demonstrate that the pages are automatically updated * Allow a context to be passed to the block icon --- .../block-editor/src/components/block-icon/index.js | 6 ++++-- .../off-canvas-editor/block-select-button.js | 6 +++++- packages/block-library/src/page-list/index.js | 10 ++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/components/block-icon/index.js b/packages/block-editor/src/components/block-icon/index.js index ad3484c9e4a04..58d7b3a04adb9 100644 --- a/packages/block-editor/src/components/block-icon/index.js +++ b/packages/block-editor/src/components/block-icon/index.js @@ -10,14 +10,16 @@ import { Icon } from '@wordpress/components'; import { blockDefault } from '@wordpress/icons'; import { memo } from '@wordpress/element'; -function BlockIcon( { icon, showColors = false, className } ) { +function BlockIcon( { icon, showColors = false, className, context } ) { if ( icon?.src === 'block-default' ) { icon = { src: blockDefault, }; } - const renderedIcon = ; + const renderedIcon = ( + + ); const style = showColors ? { backgroundColor: icon && icon.background, diff --git a/packages/block-editor/src/components/off-canvas-editor/block-select-button.js b/packages/block-editor/src/components/off-canvas-editor/block-select-button.js index 9477eb2cda40c..a3cb64e9298dd 100644 --- a/packages/block-editor/src/components/off-canvas-editor/block-select-button.js +++ b/packages/block-editor/src/components/off-canvas-editor/block-select-button.js @@ -79,7 +79,11 @@ function ListViewBlockSelectButton( aria-hidden={ true } > - + { + if ( context === 'list-view' ) { + return update; + } + + return pages; + }, example: {}, edit, };