From b5d385e0378803e030678eeda6901e99655b776d Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Fri, 9 Dec 2022 16:28:56 +0000 Subject: [PATCH 1/2] Page List: Update the icon to demonstrate that the pages are automatically updated --- packages/block-library/src/page-list/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/page-list/index.js b/packages/block-library/src/page-list/index.js index 7e13c23f229f2e..e1de31bc890294 100644 --- a/packages/block-library/src/page-list/index.js +++ b/packages/block-library/src/page-list/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { pages as icon } from '@wordpress/icons'; +import { update as icon } from '@wordpress/icons'; /** * Internal dependencies From d829f11627237f4d452c69607fae5c2e6c1b86aa Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Mon, 12 Dec 2022 10:56:44 +0000 Subject: [PATCH 2/2] 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 ad3484c9e4a049..58d7b3a04adb9e 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 9477eb2cda40c0..a3cb64e9298dd4 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, };