Skip to content

Commit 9f9aaa6

Browse files
madsrasmusseniOvergaard
authored andcommitted
do not set icon color if item is active
1 parent 594036c commit 9f9aaa6

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-base/tree-item-element-base.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export abstract class UmbTreeItemElementBase<TreeItemModelType extends UmbTreeIt
2020
hideActions: boolean = false;
2121

2222
@state()
23-
private _isActive = false;
23+
protected _isActive = false;
2424

2525
@state()
2626
private _childItems?: TreeItemModelType[];
@@ -150,9 +150,10 @@ export abstract class UmbTreeItemElementBase<TreeItemModelType extends UmbTreeIt
150150
#renderIcon() {
151151
const icon = this._item?.icon;
152152
const isFolder = this._item?.isFolder;
153+
const iconWithoutColor = icon?.split(' ')[0];
153154

154-
if (icon) {
155-
return html`<umb-icon slot="icon" name="${icon}"></umb-icon>`;
155+
if (icon && iconWithoutColor) {
156+
return html`<umb-icon slot="icon" name="${this._isActive ? iconWithoutColor : icon}"></umb-icon>`;
156157
}
157158

158159
if (isFolder) {

src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/tree-item/document-tree-item.element.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,14 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
7676
}
7777

7878
override renderIconContainer() {
79+
const icon = this.item?.documentType.icon;
80+
const iconWithoutColor = icon?.split(' ')[0];
81+
7982
return html`
8083
<span id="icon-container" slot="icon" class=${classMap({ draft: this.#isDraft() })}>
81-
${this.item?.documentType.icon
84+
${icon && iconWithoutColor
8285
? html`
83-
<umb-icon id="icon" slot="icon" name="${this.item.documentType.icon}"></umb-icon>
86+
<umb-icon id="icon" slot="icon" name="${this._isActive ? iconWithoutColor : icon}"></umb-icon>
8487
${this.#renderStateIcon()}
8588
`
8689
: nothing}

src/Umbraco.Web.UI.Client/src/packages/media/media/tree/tree-item/media-tree-item.element.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ const elementName = 'umb-media-tree-item';
77
@customElement(elementName)
88
export class UmbMediaTreeItemElement extends UmbTreeItemElementBase<UmbMediaTreeItemModel> {
99
override renderIconContainer() {
10+
const icon = this.item?.mediaType.icon;
11+
const iconWithoutColor = icon?.split(' ')[0];
12+
1013
return html`
1114
<span id="icon-container" slot="icon">
12-
${this.item?.mediaType.icon
15+
${icon && iconWithoutColor
1316
? html`
14-
<umb-icon id="icon" slot="icon" name="${this.item.mediaType.icon}"></umb-icon>
17+
<umb-icon id="icon" slot="icon" name="${this._isActive ? iconWithoutColor : icon}"></umb-icon>
1518
${this.#renderStateIcon()}
1619
`
1720
: nothing}

0 commit comments

Comments
 (0)