Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template part icons in the library mosaic (grid items) #51963

Merged
merged 4 commits into from
Jun 28, 2023
Merged
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
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