From 2ecd216a93a30b18185a0383844440462ab32cb2 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Wed, 28 Jun 2023 13:56:57 +0200 Subject: [PATCH] Add template part icons to the library grid items (#51963) --- .../src/components/page-library/grid-item.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/page-library/grid-item.js b/packages/edit-site/src/components/page-library/grid-item.js index 586602d1ac05d..fa6793ca78178 100644 --- a/packages/edit-site/src/components/page-library/grid-item.js +++ b/packages/edit-site/src/components/page-library/grid-item.js @@ -20,7 +20,13 @@ import { useInstanceId } from '@wordpress/compose'; import { useDispatch } from '@wordpress/data'; import { useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; -import { Icon, moreHorizontal } from '@wordpress/icons'; +import { + Icon, + header, + footer, + symbolFilled, + moreHorizontal, +} from '@wordpress/icons'; import { store as noticesStore } from '@wordpress/notices'; import { store as reusableBlocksStore } from '@wordpress/reusable-blocks'; import { DELETE, BACKSPACE } from '@wordpress/keycodes'; @@ -89,6 +95,15 @@ export default function GridItem( { categoryId, composite, icon, item } ) { ariaDescription = item.description; } + let itemIcon = icon; + if ( categoryId === 'header' ) { + itemIcon = header; + } else if ( categoryId === 'footer' ) { + itemIcon = footer; + } else if ( categoryId === 'uncategorized' ) { + itemIcon = symbolFilled; + } + return ( <>
@@ -127,7 +142,7 @@ export default function GridItem( { categoryId, composite, icon, item } ) { spacing={ 3 } className="edit-site-library__pattern-title" > - { icon && } + { icon && } { item.title } { item.type === USER_PATTERNS && (