Skip to content

Commit d792699

Browse files
committed
Add vertical lines that match brackets
1 parent af0fceb commit d792699

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

projects/ngx-json-treeview/src/lib/ngx-json-treeview.component.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,18 @@
6666
}
6767
</div>
6868
@if (expandable && segment.expanded) {
69-
<div class="children">
70-
<ngx-json-treeview
71-
[json]="segment.value"
72-
[expanded]="expanded()"
73-
[depth]="depth()"
74-
[isClickableValue]="isClickableValue()"
75-
[enableClickableValues]="enableClickableValues()"
76-
[_parent]="segment"
77-
[_currentDepth]="_currentDepth() + 1"
78-
(onValueClick)="onValueClickHandler($event)" />
69+
<div class="children-container">
70+
<div class="children">
71+
<ngx-json-treeview
72+
[json]="segment.value"
73+
[expanded]="expanded()"
74+
[depth]="depth()"
75+
[isClickableValue]="isClickableValue()"
76+
[enableClickableValues]="enableClickableValues()"
77+
[_parent]="segment"
78+
[_currentDepth]="_currentDepth() + 1"
79+
(onValueClick)="onValueClickHandler($event)" />
80+
</div>
7981
<span class="punctuation">
8082
{{ closingBrace }}{{ needsComma ? ',' : '' }}
8183
</span>

projects/ngx-json-treeview/src/lib/ngx-json-treeview.component.scss

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,23 @@ $type-colors: (
5454
}
5555
}
5656

57-
.children {
57+
.children-container {
5858
margin-left: 12px;
59+
60+
.children {
61+
position: relative;
62+
}
63+
}
64+
65+
// Vertical line for connecting child segments
66+
.children-container > .children::before {
67+
content: "";
68+
position: absolute;
69+
left: 0.2em;
70+
top: 0;
71+
bottom: 0;
72+
width: 1px;
73+
background-color: var(--ngx-json-tree-line, #dcdbdb);
5974
}
6075
}
6176

0 commit comments

Comments
 (0)