Skip to content

Commit 0845a18

Browse files
carolinansethrubenstein
authored andcommitted
Add template part icons to the library grid items (WordPress#51963)
1 parent 96131c3 commit 0845a18

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

packages/edit-site/src/components/page-library/grid-item.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ import { useInstanceId } from '@wordpress/compose';
2020
import { useDispatch } from '@wordpress/data';
2121
import { useState } from '@wordpress/element';
2222
import { __, sprintf } from '@wordpress/i18n';
23-
import { Icon, moreHorizontal } from '@wordpress/icons';
23+
import {
24+
Icon,
25+
header,
26+
footer,
27+
symbolFilled,
28+
moreHorizontal,
29+
} from '@wordpress/icons';
2430
import { store as noticesStore } from '@wordpress/notices';
2531
import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
2632
import { DELETE, BACKSPACE } from '@wordpress/keycodes';
@@ -89,6 +95,15 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
8995
ariaDescription = item.description;
9096
}
9197

98+
let itemIcon = icon;
99+
if ( categoryId === 'header' ) {
100+
itemIcon = header;
101+
} else if ( categoryId === 'footer' ) {
102+
itemIcon = footer;
103+
} else if ( categoryId === 'uncategorized' ) {
104+
itemIcon = symbolFilled;
105+
}
106+
92107
return (
93108
<>
94109
<div className={ patternClassNames }>
@@ -127,7 +142,7 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
127142
spacing={ 3 }
128143
className="edit-site-library__pattern-title"
129144
>
130-
{ icon && <Icon icon={ icon } /> }
145+
{ icon && <Icon icon={ itemIcon } /> }
131146
<Heading level={ 5 }>{ item.title }</Heading>
132147
</HStack>
133148
{ item.type === USER_PATTERNS && (

0 commit comments

Comments
 (0)