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

Commit fb8434e

Browse files
Travis1282Travis Clarkhlomzik
authored
Fix: DEV-1956: new label inside new label (#541)
* add react-vtree and react-window as dependencies * agnostic virtual large tree data viewing component * integrate virtual tree component with taxonomy selector * imput and scrollbar padding adjustment, fix height on search and browser percentage calcualtion * removed react-vtree from dependencies, replicated functionality with react-window alone * support adding child components and couting total nested children * adjust window hight and scrolling * null block treeStructure when menu is closed * new row is actual row, expand parent * new Items add at top of list, remove unused * update enzyme-adapter to work with react@17 * update yarn.lock * trigger CI * update node version to 14 * update enzyme dependencies * update lock-files. again * revert mistaken data reorder * margin to add button and input Co-authored-by: Travis Clark <“[email protected]”> Co-authored-by: hlomzik <[email protected]>
1 parent ba3b498 commit fb8434e

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

src/components/Taxonomy/Taxonomy.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@
178178
zoom: 1; // something to apply this class
179179
}
180180

181+
.taxonomy__add__container {
182+
margin-bottom: 8px;
183+
}
184+
181185
.taxonomy__add {
182186
margin-left: 27px; // chevron 24px + 3px margin
183187
display: flex;

src/components/Taxonomy/Taxonomy.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,17 @@ const TaxonomyDropdown = ({ show, flatten, items, dropdownRef }: TaxonomyDropdow
353353
transformationCallback={dataTransformation}
354354
/>
355355
)}
356-
{onAddLabel &&
357-
search === "" &&
358-
(isAdding ? (
359-
<UserLabelForm path={[]} onAddLabel={onAddLabel} onFinish={closeForm} />
360-
) : (
361-
<div className={styles.taxonomy__add}>
362-
<button onClick={addInside}>Add</button>
363-
</div>
364-
))}
356+
{onAddLabel && search === "" && (
357+
<div className={styles.taxonomy__add__container}>
358+
{isAdding ? (
359+
<UserLabelForm path={[]} onAddLabel={onAddLabel} onFinish={closeForm} />
360+
) : (
361+
<div className={styles.taxonomy__add}>
362+
<button onClick={addInside}>Add</button>
363+
</div>
364+
)}
365+
</div>
366+
)}
365367
</div>
366368
);
367369
};

src/stores/UserLabels.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ const UserLabels = types
1717
.actions(self => ({
1818
addLabel(control: string, path: string[]) {
1919
const label: UserLabel = { path, origin: "session" };
20-
const labels = [label, ...(self.controls[control] ?? [])];
20+
const labels = [...(self.controls[control] ?? []), label];
2121

2222
self.controls = { ...self.controls, [control]: labels };
2323
},
2424

2525
deleteLabel(control: string, path: string[]) {
2626
if (!self.controls[control]) return;
27-
2827
const labels = self.controls[control].filter(existed =>
2928
existed.path.length !== path.length
3029
|| !existed.path.every((item, index) => item === path[index]));
@@ -41,7 +40,6 @@ const UserLabels = types
4140
path,
4241
}));
4342
}
44-
4543
self.controls = adjusted;
4644
},
4745
}));

0 commit comments

Comments
 (0)