Skip to content

Commit

Permalink
Add template part icons to the library grid items (WordPress#51963)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinan authored and sethrubenstein committed Jul 13, 2023
1 parent 96131c3 commit 0845a18
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/edit-site/src/components/page-library/grid-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 (
<>
<div className={ patternClassNames }>
Expand Down Expand Up @@ -127,7 +142,7 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
spacing={ 3 }
className="edit-site-library__pattern-title"
>
{ icon && <Icon icon={ icon } /> }
{ icon && <Icon icon={ itemIcon } /> }
<Heading level={ 5 }>{ item.title }</Heading>
</HStack>
{ item.type === USER_PATTERNS && (
Expand Down

0 comments on commit 0845a18

Please sign in to comment.