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 Jun 28, 2023
1 parent d488747 commit 2ecd216
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

1 comment on commit 2ecd216

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 2ecd216.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5400776094
📝 Reported issues:

Please sign in to comment.