File tree 3 files changed +14
-7
lines changed
src/Umbraco.Web.UI.Client/src/packages
core/tree/tree-item/tree-item-base
documents/documents/tree/tree-item
media/media/tree/tree-item
3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export abstract class UmbTreeItemElementBase<TreeItemModelType extends UmbTreeIt
20
20
hideActions : boolean = false ;
21
21
22
22
@state ( )
23
- private _isActive = false ;
23
+ protected _isActive = false ;
24
24
25
25
@state ( )
26
26
private _childItems ?: TreeItemModelType [ ] ;
@@ -150,9 +150,10 @@ export abstract class UmbTreeItemElementBase<TreeItemModelType extends UmbTreeIt
150
150
#renderIcon( ) {
151
151
const icon = this . _item ?. icon ;
152
152
const isFolder = this . _item ?. isFolder ;
153
+ const iconWithoutColor = icon ?. split ( ' ' ) [ 0 ] ;
153
154
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 > ` ;
156
157
}
157
158
158
159
if ( isFolder ) {
Original file line number Diff line number Diff line change @@ -76,11 +76,14 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
76
76
}
77
77
78
78
override renderIconContainer ( ) {
79
+ const icon = this . item ?. documentType . icon ;
80
+ const iconWithoutColor = icon ?. split ( ' ' ) [ 0 ] ;
81
+
79
82
return html `
80
83
<span id= "icon-container" slot = "icon" class = ${ classMap ( { draft : this . #isDraft( ) } ) } >
81
- ${ this . item ?. documentType . icon
84
+ ${ icon && iconWithoutColor
82
85
? 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>
84
87
${ this . #renderStateIcon( ) }
85
88
`
86
89
: nothing }
Original file line number Diff line number Diff line change @@ -7,11 +7,14 @@ const elementName = 'umb-media-tree-item';
7
7
@customElement ( elementName )
8
8
export class UmbMediaTreeItemElement extends UmbTreeItemElementBase < UmbMediaTreeItemModel > {
9
9
override renderIconContainer ( ) {
10
+ const icon = this . item ?. mediaType . icon ;
11
+ const iconWithoutColor = icon ?. split ( ' ' ) [ 0 ] ;
12
+
10
13
return html `
11
14
<span id= "icon-container" slot = "icon" >
12
- ${ this . item ?. mediaType . icon
15
+ ${ icon && iconWithoutColor
13
16
? 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>
15
18
${ this . #renderStateIcon( ) }
16
19
`
17
20
: nothing }
You can’t perform that action at this time.
0 commit comments