Skip to content

Commit

Permalink
Add template part icons to the library grid items (#51963)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinan authored and tellthemachines committed Jul 3, 2023
1 parent b0a5943 commit b64bc8a
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 @@ -88,6 +94,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 @@ -126,7 +141,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 b64bc8a

Please sign in to comment.