currentNodeId

This commit is contained in:
Niels Lyngsø
2022-06-02 13:25:49 +02:00
parent 44c25b2a55
commit 146efd5cc1
2 changed files with 7 additions and 6 deletions

View File

@@ -24,6 +24,9 @@ export class UmbContentSection extends LitElement {
{
path: 'dashboard',
component: () => import('../../../section/section-dashboards.element'),
setup: () => {
this._currentNodeId = undefined;
},
},
{
path: 'node/:nodeId',
@@ -40,13 +43,12 @@ export class UmbContentSection extends LitElement {
];
@state()
private _currentNodeId!: string;
private _currentNodeId?: string;
render() {
return html`
<!-- TODO: Figure out how we name layout components -->
<umb-section-sidebar>
<umb-content-tree .id="${this._currentNodeId}"></umb-content-tree>
<umb-content-tree .currentNodeId="${this._currentNodeId}"></umb-content-tree>
</umb-section-sidebar>
<router-slot id="router-slot" .routes="${this._routes}"></router-slot>
`;

View File

@@ -15,7 +15,7 @@ class UmbContentTree extends LitElement {
];
@property()
public id!: string;
public currentNodeId?: string;
// simplified tree data for testing
@state()
@@ -34,8 +34,7 @@ class UmbContentTree extends LitElement {
${this._tree.map(
(item) => html`
<uui-menu-item
?active="${parseInt(this.id) === item.id}"
data-id="${item.id}"
?active="${parseInt(this.currentNodeId || '-1') === item.id}"
label="${item.name}"
href="/section/content/node/${item.id}">
<uui-icon slot="icon" name="${item.icon}"></uui-icon>