Skip to content

Commit 1b6ead1

Browse files
authored
Merge pull request #174 from hidde/orgchart-v2
Implement org chart hierarchy improvements
2 parents c93fcf6 + b68bf84 commit 1b6ead1

1 file changed

Lines changed: 38 additions & 4 deletions

File tree

src/components/OrgNode.vue

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,41 @@
1212
</ul>
1313
</template>
1414
<template slot="icon-expanded">
15-
<img src="@/assets/images/collapse.svg" alt="" width="16" aria-hidden="true" class="org-node__icon" />
15+
<svg
16+
xmlns="http://www.w3.org/2000/svg"
17+
width="16"
18+
height="16"
19+
viewBox="0 0 24 24"
20+
fill="none"
21+
stroke="currentColor"
22+
stroke-width="2"
23+
stroke-linecap="round"
24+
stroke-linejoin="round"
25+
>
26+
<polyline points="6 9 12 15 18 9" />
27+
</svg>
1628
</template>
1729
<template slot="icon-collapsed">
18-
<img src="@/assets/images/expand.svg" alt="" width="16" aria-hidden="true" class="org-node__icon"/>
30+
<svg
31+
xmlns="http://www.w3.org/2000/svg"
32+
width="16"
33+
height="16"
34+
viewBox="0 0 24 24"
35+
fill="none"
36+
stroke="currentColor"
37+
stroke-width="2"
38+
stroke-linecap="round"
39+
stroke-linejoin="round"
40+
>
41+
<polyline points="9 18 15 12 9 6" />
42+
</svg>
1943
</template>
2044
</ShowMore>
45+
<template v-else>
46+
<svg class="org-node__no-children-indicator" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22">
47+
<circle cx="2" cy="2" r="2" fill="#B1B1B3" fill-rule="evenodd" transform="translate(9 9.308)"/>
48+
</svg>
49+
</template>
2150
</li>
2251
</template>
2352

@@ -124,7 +153,7 @@ export default {
124153
text-decoration: none;
125154
color: inherit;
126155
padding-left: 2em;
127-
padding-left: calc(((var(--nodeLevel) + 1) * 1em) + 1.25em);
156+
padding-left: calc((var(--nodeLevel) * 2em) + 1.25em);
128157
border-left: .25em solid transparent;
129158
}
130159
.org-node--current > a,
@@ -160,7 +189,7 @@ export default {
160189
position: absolute;
161190
top: 0;
162191
left: 0;
163-
left: calc((var(--nodeLevel) - 1) * 1em + .5em);
192+
left: calc((var(--nodeLevel) * 2em) - 1.5em);
164193
width: 2.5em;
165194
height: 2.5em;
166195
margin: .75em 0;
@@ -197,4 +226,9 @@ export default {
197226
float: left;
198227
margin-right: .75em;
199228
}
229+
.org-node__no-children-indicator {
230+
position: absolute;
231+
top: 1.125em;
232+
left: calc((var(--nodeLevel) * 2em) - 1.125em);
233+
}
200234
</style>

0 commit comments

Comments
 (0)