Skip to content

Commit e5c942b

Browse files
authored
Block Grid: Add icon to allowed block types in area (#20364)
* Add icon to allowed block types in area * Adjust type with icon property * Use umb-icon instead * Add styling for combo list option
1 parent 28fa373 commit e5c942b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-area-type-permission/block-grid-area-type-permission.element.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class UmbPropertyEditorUIBlockGridAreaTypePermissionElement
3333
private _blockTypes?: Array<UmbBlockTypeWithGroupKey>;
3434

3535
@state()
36-
private _blockTypesWithElementName: Array<{ type: UmbBlockTypeWithGroupKey; name: string }> = [];
36+
private _blockTypesWithElementName: Array<{ type: UmbBlockTypeWithGroupKey; name: string; icon: string | null | undefined }> = [];
3737

3838
@state()
3939
private _blockGroups: Array<UmbBlockGridTypeGroupType> = [];
@@ -51,11 +51,11 @@ export class UmbPropertyEditorUIBlockGridAreaTypePermissionElement
5151
.map((item) => {
5252
const blockType = this._blockTypes?.find((block) => block.contentElementTypeKey === item.unique);
5353
if (blockType) {
54-
return { type: blockType, name: item.name };
54+
return { type: blockType, name: item.name, icon: item.icon };
5555
}
5656
return undefined;
5757
})
58-
.filter((x) => x !== undefined) as Array<{ type: UmbBlockTypeWithGroupKey; name: string }>;
58+
.filter((x) => x !== undefined) as Array<{ type: UmbBlockTypeWithGroupKey; name: string; icon: string | null | undefined }>;
5959
});
6060

6161
this.consumeContext(UMB_DATA_TYPE_WORKSPACE_CONTEXT, async (context) => {
@@ -193,7 +193,10 @@ export class UmbPropertyEditorUIBlockGridAreaTypePermissionElement
193193
this._blockGroups,
194194
(group) => group.key,
195195
(group) =>
196-
html`<uui-combobox-list-option .value=${group.key} ?selected=${area.groupKey === group.key}>
196+
html`<uui-combobox-list-option
197+
.value=${group.key}
198+
?selected=${area.groupKey === group.key}>
199+
<umb-icon name="icon-folder"></umb-icon>
197200
${group.name}
198201
</uui-combobox-list-option>`,
199202
);
@@ -207,6 +210,7 @@ export class UmbPropertyEditorUIBlockGridAreaTypePermissionElement
207210
html`<uui-combobox-list-option
208211
.value=${block.type.contentElementTypeKey}
209212
?selected=${area.elementTypeKey === block.type.contentElementTypeKey}>
213+
<umb-icon name=${block.icon}></umb-icon>
210214
${block.name}
211215
</uui-combobox-list-option>`,
212216
);
@@ -245,6 +249,13 @@ export class UmbPropertyEditorUIBlockGridAreaTypePermissionElement
245249
uui-combobox strong {
246250
padding: 0 var(--uui-size-space-1);
247251
}
252+
253+
uui-combobox-list-option {
254+
display: flex;
255+
align-items: center;
256+
gap: var(--uui-size-space-2);
257+
padding: var(--uui-size-2);
258+
}
248259
`,
249260
];
250261
}

0 commit comments

Comments
 (0)