Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/block-editor/src/components/block-icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <Icon icon={ icon && icon.src ? icon.src : icon } />;
const renderedIcon = (
<Icon icon={ icon && icon.src ? icon.src : icon } context={ context } />
);
const style = showColors
? {
backgroundColor: icon && icon.background,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ function ListViewBlockSelectButton(
aria-hidden={ true }
>
<ListViewExpander onClick={ onToggleExpanded } />
<BlockIcon icon={ blockInformation?.icon } showColors />
<BlockIcon
icon={ blockInformation?.icon }
showColors
context="list-view"
/>
<HStack
alignment="center"
className="block-editor-list-view-block-select-button__label-wrapper"
Expand Down
10 changes: 8 additions & 2 deletions packages/block-library/src/page-list/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { pages as icon } from '@wordpress/icons';
import { pages, update } from '@wordpress/icons';

/**
* Internal dependencies
Expand All @@ -15,7 +15,13 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
icon,
icon: ( { context } ) => {
if ( context === 'list-view' ) {
return update;
}

return pages;
},
example: {},
edit,
};
Expand Down