Skip to content

Commit d714649

Browse files
authored
Merge pull request #498 from GSA/tree-table
Add css for tree-table
2 parents 1b71791 + d05abe6 commit d714649

2 files changed

Lines changed: 157 additions & 0 deletions

File tree

src/stylesheets/components/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
@import 'toolbar';
3232
@import 'toasts';
3333
@import 'toolbar';
34+
@import 'treetable';
3435
@import 'searchlayout';
3536
@import 'icon';
3637
@import 'load';
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
.sds-tree-table--scrollable {
2+
overflow: scroll;
3+
4+
.sds-tree-table {
5+
width: 59.25rem;
6+
}
7+
}
8+
9+
table.sds-tree-table {
10+
border-collapse:separate;
11+
border-spacing: 0 5px;
12+
13+
thead {
14+
th {
15+
border: none;
16+
@include u-padding(2);
17+
@include u-bg('accent-cool-lighter');
18+
}
19+
20+
@include u-border('accent-cool-light');
21+
}
22+
23+
tbody {
24+
25+
td {
26+
border-style: none;
27+
position: relative;
28+
.horizontal-border {
29+
border-top: 3px dashed;
30+
height: 1px;
31+
position: absolute;
32+
width: 100%;
33+
top: 50%;
34+
color: color('ink');
35+
}
36+
37+
.vertical-border {
38+
border-left: 3px dashed;
39+
width: 1px;
40+
height: 100%;
41+
position: absolute;
42+
bottom: 40px;
43+
color: color('ink');
44+
}
45+
}
46+
47+
tr:not(.text-center) {
48+
49+
td:first-child {
50+
position: relative;
51+
.usa-button {
52+
cursor: pointer;
53+
top: 0.25rem;
54+
color: color('accent-cool');
55+
svg {
56+
background-color: color('ink');
57+
border-radius: 50%;
58+
}
59+
}
60+
61+
.usa-button:hover {
62+
filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.1));
63+
}
64+
}
65+
66+
td:nth-child(2) {
67+
border-left: 1px solid color('base-light');
68+
}
69+
70+
td:not(:first-child) {
71+
border-top: 1px solid color('base-light');
72+
border-bottom: 1px solid color('base-light');
73+
}
74+
75+
td:last-child {
76+
border-right: 1px solid color('base-light');
77+
}
78+
}
79+
80+
tr[aria-expanded] {
81+
td {
82+
background-color: color('base-lightest');
83+
}
84+
85+
td:first-child {
86+
background-color: unset;
87+
}
88+
}
89+
90+
91+
tr[aria-level="1"] {
92+
.vertical-border {
93+
margin-left: 1rem;
94+
margin-top: 1rem;
95+
}
96+
97+
.horizontal-border {
98+
margin-left: 2rem;
99+
}
100+
}
101+
}
102+
103+
104+
.sds-tree-table__row--selected:not(.text-center) {
105+
td:nth-child(2) {
106+
@include u-border-left('secondary');
107+
}
108+
109+
td:not(:first-child) {
110+
@include u-border-top('secondary');
111+
@include u-border-bottom('secondary');
112+
}
113+
114+
td:last-child {
115+
@include u-border-right('secondary');
116+
}
117+
}
118+
119+
.sds-tree-table__row--highlight-border > td {
120+
.vertical-border-top {
121+
border-color: color('secondary');
122+
}
123+
124+
.vertical-border {
125+
border-color: color('secondary');
126+
}
127+
128+
.horizontal-border {
129+
border-color: color('secondary');
130+
}
131+
}
132+
133+
134+
// CSS for up to 10 nested children
135+
@for $i from 1 through 10 {
136+
tr[aria-level="#{$i}"] {
137+
td:nth-child(2), .usa-button {
138+
position: relative;
139+
left: #{($i * 1.5) - 1.5}rem;
140+
}
141+
142+
td:nth-child(2) {
143+
padding-right: #{($i * 1.5) - 1.5}rem;
144+
}
145+
146+
.vertical-border, .horizontal-border {
147+
margin-left: #{($i * 1.5) - 2}rem;
148+
}
149+
}
150+
151+
tr[aria-level="#{$i}"][aria-expanded="true"] .vertical-border {
152+
margin-left: #{($i * 1.5) - 0.5}rem;
153+
}
154+
155+
}
156+
}

0 commit comments

Comments
 (0)