Skip to content

Commit 751bed9

Browse files
committed
Add some formatting to the macro tree structure.
1 parent a32fd88 commit 751bed9

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

packages/uhk-web/src/app/components/side-menu/side-menu.component.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,18 @@
221221
class="chevron float-end me-1"
222222
(click)="toggleMenuItem('macro')"></fa-icon>
223223
</div>
224-
<ul [@toggler]="this.sideMenuState.macro.animation">
225-
<ng-container *ngTemplateOutlet="macroTree; context: { $implicit: state.macroTree, depth: 0 }"></ng-container>
224+
<ul class="sidebar__macro-tree" [@toggler]="this.sideMenuState.macro.animation">
225+
<ng-container *ngTemplateOutlet="macroTree; context: { $implicit: state.macroTree }"></ng-container>
226226
</ul>
227227
</li>
228228
</ul>
229229
</li>
230230
</ul>
231231

232-
<ng-template #macroTree let-nodes let-depth="depth">
232+
<ng-template #macroTree let-nodes>
233233
<ng-container *ngFor="let node of nodes">
234234
<li *ngIf="node.type === 'macro'" class="sidebar__macro-tree-item">
235-
<div class="sidebar__macro-tree-entry" [style.--macro-depth]="depth" [routerLinkActive]="['active']">
235+
<div class="sidebar__macro-tree-entry" [routerLinkActive]="['active']">
236236
<a [routerLink]="['/macro', node.macro.id]"
237237
[class.disabled]="state.updatingFirmware">{{ getMacroDisplayName(node) }}</a>
238238
<span class="sidebar__macro_count badge rounded-pill"
@@ -243,14 +243,13 @@
243243
</li>
244244
<li *ngIf="node.type === 'group'" class="sidebar__macro-tree-item">
245245
<div class="sidebar__macro-tree-entry sidebar__macro-group"
246-
[style.--macro-depth]="depth"
247246
(click)="toggleMacroGroup(node.path)">
248-
{{ node.label }}
247+
{{ node.label }}
249248
<fa-icon [icon]="getMacroGroupArrowIcon(node.path)"
250249
class="sidebar__macro-group-arrow"></fa-icon>
251250
</div>
252-
<ul [@toggler]="getMacroGroupState(node.path).animation">
253-
<ng-container *ngTemplateOutlet="macroTree; context: { $implicit: node.children, depth: depth + 1 }"></ng-container>
251+
<ul class="sidebar__macro-group-children" [@toggler]="getMacroGroupState(node.path).animation">
252+
<ng-container *ngTemplateOutlet="macroTree; context: { $implicit: node.children }"></ng-container>
254253
</ul>
255254
</li>
256255
</ng-container>

packages/uhk-web/src/app/components/side-menu/side-menu.component.scss

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,22 @@ ul {
142142
}
143143
}
144144

145+
// Indentation is purely structural: it comes from the nested <ul> lists, not
146+
// from any per-leaf padding. The root list supplies the base indent and each
147+
// nested group list adds one step, so depth accumulates through the DOM.
145148
&__macro-tree-entry {
146-
padding: 0.125rem 0 0.125rem calc(#{$macro-tree-base-indent} + var(--macro-depth, 0) * #{$macro-tree-indent-step});
149+
padding: 0.125rem 0;
150+
}
151+
152+
&__macro-tree {
153+
width: auto;
154+
margin-left: $macro-tree-base-indent;
155+
}
156+
157+
&__macro-group-children {
158+
width: auto;
159+
padding-left: $macro-tree-indent-step;
160+
border-left: 1px solid silver;
147161
}
148162

149163
&__macro-tree-item {
@@ -179,6 +193,7 @@ ul {
179193

180194
&__macro-group {
181195
cursor: pointer;
196+
font-weight: 500;
182197

183198
&-arrow {
184199
float: right;

0 commit comments

Comments
 (0)