Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 5a0a4bf

Browse files
authored
feat: DEV-1536: user created labels for Taxonomy (#483)
* fix Taxonomy styles * display tree structure even on search * feat: add userLabels to annotation and Taxonomy * Add user labels to Taxonomy * Add styles to user labels in taxonomy * Add new label form into every subtree; add styles * Distinguish labels from current and prev sessions Labels from current session can be renamed or removed Add `origin` to UserLabels store to keep track of them Color session labels in blue * Add dropdown to every label with "Add Inside" That's the only action for now to add new labels Changed UX of this small form - correct blur, saving and cancelling * some comments * Fix top level "add new label" form - button+styles * Allow to delete session labels also fix styles of right extra block - count and actions * Hide user labels behind feature flag * fix style of taxonomy selected items * fix crash during search in deep trees * fix appearance on search: open all, hide extra - don't show counts and context menu - don't show +Add button - always open all the levels * fix jumping when user select first item
1 parent d8c3d1b commit 5a0a4bf

File tree

7 files changed

+407
-61
lines changed

7 files changed

+407
-61
lines changed

src/assets/icons/chevron.svg

Lines changed: 2 additions & 2 deletions
Loading

src/components/Taxonomy/Taxonomy.module.scss

Lines changed: 117 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,49 @@
77
position: relative;
88

99
& > span {
10-
display: inline-block;
11-
line-height: 32px;
12-
padding: 0 5px; // 4px padding + 1px border to stay on the same indent as selected
10+
display: flex;
11+
align-items: center;
12+
line-height: 30px;
13+
padding: 0 4px; // 4px padding to stay on the same indent as selected
1314
margin-bottom: 4px; // also replaces padding to be consistent with selected divs
1415
white-space: nowrap;
1516
cursor: pointer;
16-
17-
&::after {
18-
content: "";
19-
display: inline-block;
20-
margin-left: 6px;
21-
border-width: 9px 5px 0;
22-
border-color: #444 transparent transparent;
23-
border-style: solid;
24-
}
2517
}
2618
}
2719

28-
.taxonomy_open > span::after {
20+
.taxonomy > span > svg {
2921
transform: rotate(-180deg);
3022
}
23+
.taxonomy_open > span > svg {
24+
transform: none;
25+
}
3126

3227
.taxonomy__selected {
33-
display: inline-flex;
28+
display: flex;
3429
flex-wrap: wrap;
30+
min-height: 28px; // 24px button + 4px margin
3531

3632
div {
37-
margin: 0 4px 4px 0;
38-
background: #f4f4f4;
39-
padding: 2px 4px;
40-
border: 1px solid #d9d9d9;
33+
margin: 0 2px 4px 0;
34+
background: hsl(0, 0%, 95%);
35+
padding: 0; // all the right space should be a clickable button, so no padding
36+
padding-left: 8px;
4137
border-radius: 4px;
38+
display: flex;
39+
align-items: center;
4240
}
4341

4442
input[type=button] {
4543
border: none;
4644
background: none;
4745
cursor: pointer;
48-
padding: 6px 0 6px 12px;
46+
width: 24px;
47+
height: 24px;
48+
padding: 0;
49+
line-height: 1;
50+
font-weight: 500;
51+
font-size: 20px;
52+
color: #09f;
4953

5054
&:hover {
5155
color: red;
@@ -58,15 +62,14 @@
5862
z-index: 10;
5963
background: white;
6064
border-radius: 6px;
61-
padding: 8px;
6265
max-height: 60vh;
6366
overflow-y: auto;
6467
left: -1px;
6568
width: max-content;
6669
min-width: 100%;
6770
max-width: 50vw; // 100% is not enough
68-
margin-top: 9px; // 4px padding + 1px border + 4px gap
69-
box-shadow: 0 0 4px #d9d9d9;
71+
border: 1px solid #e2e2e2;
72+
box-shadow: 0 4px 10px rgb(0 0 0 / 12%);
7073

7174
input[type=checkbox] {
7275
margin-right: 4px;
@@ -85,14 +88,21 @@
8588

8689
.taxonomy__search {
8790
width: 100%;
88-
border: 1px solid #d9d9d9;
89-
border-radius: 3px;
91+
border: none;
92+
border-bottom: 1px solid #e2e2e2;
93+
border-radius: 3px 3px 0 0;
9094
padding: 6px 16px;
9195
margin-bottom: 4px;
9296
box-shadow: 0 -2px 0 6px white; // white background over scrolled items
9397
position: sticky;
9498
top: 0;
9599
z-index: 1;
100+
101+
&:focus,
102+
&:focus-visible {
103+
outline: 1px solid #09f;
104+
border-bottom-color: #09f;
105+
}
96106
}
97107

98108
.taxonomy__item ~ div {
@@ -106,29 +116,110 @@
106116
&:focus-within {
107117
background: #eee;
108118
}
119+
120+
&_user,
121+
&_session {
122+
font-style: italic;
123+
}
124+
125+
&_session {
126+
color: #09f;
127+
}
109128
}
110129

111130
.taxonomy__item label {
112131
flex-grow: 1;
113132
flex-shrink: 0;
114133
line-height: 2em;
134+
padding-right: 8px;
115135
}
116136

117137
.taxonomy__grouping {
118138
font-family: monospace;
119139
font-size: 16px;
120140
display: inline-block;
121-
width: 20px;
122-
margin-left: -2px;
141+
width: 24px;
142+
height: 24px;
143+
margin-left: 3px;
123144
text-align: center;
124145
user-select: none;
125146
flex-shrink: 0;
126147

148+
svg {
149+
transition: transform 0.1s; // visible rotation of arrow
150+
}
151+
127152
&:not(:empty) {
128153
cursor: pointer;
129154
}
130155
}
131156

157+
.taxonomy__extra {
158+
margin-left: auto;
159+
opacity: 0.6;
160+
padding: 0 12px;
161+
min-width: 40px; // 24px padding + 16px width for count/dots
162+
text-align: right;
163+
164+
&_actions {
165+
display: none;
166+
font-weight: bold;
167+
cursor: pointer;
168+
text-align: center;
169+
}
170+
171+
.taxonomy__item:hover &_count:not(:last-child) {
172+
display: none;
173+
}
174+
.taxonomy__item:hover &_actions {
175+
display: block;
176+
}
177+
}
178+
179+
.taxonomy__action {
180+
zoom: 1; // something to apply this class
181+
}
182+
183+
.taxonomy__add {
184+
margin-left: 27px; // chevron 24px + 3px margin
185+
display: flex;
186+
align-items: center;
187+
opacity: 0.6;
188+
189+
&::before {
190+
content: "+";
191+
width: 16px; // as checkbox
192+
padding: 4px 0;
193+
text-align: center;
194+
font-size: 18px;
195+
line-height: 0;
196+
}
197+
198+
button {
199+
flex-grow: 1;
200+
border: none;
201+
padding: 1px 4px;
202+
font-weight: normal;
203+
text-align: left;
204+
}
205+
}
206+
207+
.taxonomy__newitem {
208+
display: flex;
209+
210+
[name=taxonomy__add] {
211+
padding: 1px 2px;
212+
border: none;
213+
flex-grow: 1;
214+
margin-left: 45px;
215+
margin-right: 8px;
216+
font: inherit;
217+
font-style: italic;
218+
color: #09f;
219+
background: rgba(0,0,0,0.03);
220+
}
221+
}
222+
132223
.taxonomy__collapsable {
133224
cursor: pointer;
134225
}

0 commit comments

Comments
 (0)