Skip to content

Commit 980f4c7

Browse files
committed
render collection icon for document tree items
1 parent 6746bef commit 980f4c7

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/packages/documents/documents/tree/tree-item/document-tree-item.element.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { UmbDocumentTreeItemModel, UmbDocumentTreeItemVariantModel } from '../types.js';
21
import { css, html, nothing, customElement, state, classMap } from '@umbraco-cms/backoffice/external/lit';
32
import type { UmbAppLanguageContext } from '@umbraco-cms/backoffice/language';
43
import { UMB_APP_LANGUAGE_CONTEXT } from '@umbraco-cms/backoffice/language';
54
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
65
import { UmbTreeItemElementBase } from '@umbraco-cms/backoffice/tree';
6+
import type { UmbDocumentTreeItemModel, UmbDocumentTreeItemVariantModel } from '../types.js';
77

88
@customElement('umb-document-tree-item')
99
export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocumentTreeItemModel> {
@@ -74,11 +74,7 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
7474
${this.item?.documentType.icon
7575
? html`
7676
<umb-icon id="icon" slot="icon" name="${this.item.documentType.icon}"></umb-icon>
77-
${this.item.isProtected ? this.#renderIsProtectedIcon() : nothing}
78-
<!--
79-
// TODO: implement correct status symbol
80-
<span id="status-symbol"></span>
81-
-->
77+
${this.#renderStateIcon()}
8278
`
8379
: nothing}
8480
</span>
@@ -91,8 +87,24 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
9187
> `;
9288
}
9389

90+
#renderStateIcon() {
91+
if (this.item?.isProtected) {
92+
return this.#renderIsProtectedIcon();
93+
}
94+
95+
if (this.item?.documentType.collection) {
96+
return this.#renderIsCollectionIcon();
97+
}
98+
99+
return nothing;
100+
}
101+
102+
#renderIsCollectionIcon() {
103+
return html`<umb-icon id="state-icon" slot="icon" name="icon-grid" title="Collection"></umb-icon>`;
104+
}
105+
94106
#renderIsProtectedIcon() {
95-
return html`<umb-icon id="icon-lock" slot="icon" name="icon-lock" title="Protected"></umb-icon>`;
107+
return html`<umb-icon id="state-icon" slot="icon" name="icon-lock" title="Protected"></umb-icon>`;
96108
}
97109

98110
static override styles = [
@@ -106,19 +118,7 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
106118
vertical-align: middle;
107119
}
108120
109-
#status-symbol {
110-
width: 5px;
111-
height: 5px;
112-
border: 1px solid white;
113-
background-color: blue;
114-
display: block;
115-
position: absolute;
116-
bottom: 0;
117-
right: 0;
118-
border-radius: 100%;
119-
}
120-
121-
#icon-lock {
121+
#state-icon {
122122
position: absolute;
123123
bottom: -5px;
124124
right: -5px;
@@ -136,30 +136,30 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
136136
text-overflow: ellipsis;
137137
}
138138
139-
:hover #icon-lock {
139+
:hover #state-icon {
140140
background: var(--uui-color-surface-emphasis);
141141
}
142142
143143
/** Active */
144-
[active] #icon-lock {
144+
[active] #state-icon {
145145
background: var(--uui-color-current);
146146
}
147147
148-
[active]:hover #icon-lock {
148+
[active]:hover #state-icon {
149149
background: var(--uui-color-current-emphasis);
150150
}
151151
152152
/** Selected */
153-
[selected] #icon-lock {
153+
[selected] #state-icon {
154154
background-color: var(--uui-color-selected);
155155
}
156156
157-
[selected]:hover #icon-lock {
157+
[selected]:hover #state-icon {
158158
background-color: var(--uui-color-selected-emphasis);
159159
}
160160
161161
/** Disabled */
162-
[disabled] #icon-lock {
162+
[disabled] #state-icon {
163163
background-color: var(--uui-color-disabled);
164164
}
165165

0 commit comments

Comments
 (0)