Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export abstract class UmbTreeItemElementBase<TreeItemModelType extends UmbTreeIt
hideActions: boolean = false;

@state()
private _isActive = false;
protected _isActive = false;

@state()
private _childItems?: TreeItemModelType[];
Expand Down Expand Up @@ -150,9 +150,10 @@ export abstract class UmbTreeItemElementBase<TreeItemModelType extends UmbTreeIt
#renderIcon() {
const icon = this._item?.icon;
const isFolder = this._item?.isFolder;
const iconWithoutColor = icon?.split(' ')[0];

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

if (isFolder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,14 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
}

override renderIconContainer() {
const icon = this.item?.documentType.icon;
const iconWithoutColor = icon?.split(' ')[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon?.split(' ')[0]; logic is shared, should it be a method on the base class that can handle the logic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if this got moved all the way to the server. If that is not possible, we should map the data when we receive it. Instead of a string with both, we should have name and color in separate props. I think we will need this in more cases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it seems like a UI concern that a picked icon and colour has to change, but I can shared your idea with the rest of the team

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise you only talk about splitting colour and icon


return html`
<span id="icon-container" slot="icon" class=${classMap({ draft: this.#isDraft() })}>
${this.item?.documentType.icon
${icon && iconWithoutColor
? html`
<umb-icon id="icon" slot="icon" name="${this.item.documentType.icon}"></umb-icon>
<umb-icon id="icon" slot="icon" name="${this._isActive ? iconWithoutColor : icon}"></umb-icon>
${this.#renderStateIcon()}
`
: nothing}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ const elementName = 'umb-media-tree-item';
@customElement(elementName)
export class UmbMediaTreeItemElement extends UmbTreeItemElementBase<UmbMediaTreeItemModel> {
override renderIconContainer() {
const icon = this.item?.mediaType.icon;
const iconWithoutColor = icon?.split(' ')[0];

return html`
<span id="icon-container" slot="icon">
${this.item?.mediaType.icon
${icon && iconWithoutColor
? html`
<umb-icon id="icon" slot="icon" name="${this.item.mediaType.icon}"></umb-icon>
<umb-icon id="icon" slot="icon" name="${this._isActive ? iconWithoutColor : icon}"></umb-icon>
${this.#renderStateIcon()}
`
: nothing}
Expand Down