Skip to content

Build your personal knowledge base with Trilium Notes

client/dialogs/sort children: use a row button for "Add level"

Adorian Dorandcdc029a3408
diff --git a/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx b/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx
index 70643dda79..da01737f42 100644
--- a/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx
+++ b/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx
@@ -102,8 +102,8 @@ describe("SortChildNotesDialog", () => {
});
it("builds a multi-level criteria string from the added levels", async () => {
- await click(container.querySelector(".sort-level-add"));
- await click(container.querySelector(".sort-level-add"));
+ await click(container.querySelector(".tn-card-adder"));
+ await click(container.querySelector(".tn-card-adder"));
expect(levels()).toHaveLength(3);
const [ first, second, third ] = levels();
@@ -125,7 +125,7 @@ describe("SortChildNotesDialog", () => {
});
it("reorders levels with the arrows, which are off at the ends", async () => {
- await click(container.querySelector(".sort-level-add"));
+ await click(container.querySelector(".tn-card-adder"));
const [ first, second ] = levels();
await choose(second.querySelector("select"), "dateCreated");
expect(first.querySelector(".sort-level-up")).toHaveProperty("disabled", true);
diff --git a/apps/client/src/widgets/dialogs/sort_child_notes.tsx b/apps/client/src/widgets/dialogs/sort_child_notes.tsx
index 8e6c856da0..a072abf0ae 100644
--- a/apps/client/src/widgets/dialogs/sort_child_notes.tsx
+++ b/apps/client/src/widgets/dialogs/sort_child_notes.tsx
@@ -11,7 +11,7 @@ import { t } from "../../services/i18n";
import server from "../../services/server";
import ActionButton from "../react/ActionButton";
import Button from "../react/Button";
-import { Card, CardSection, OptionCardSection } from "../react/Card";
+import { Card, CardSection, ItemCreationRow, OptionCardSection } from "../react/Card";
import FormSelect from "../react/FormSelect";
import FormTextBox from "../react/FormTextBox";
import FormToggle from "../react/FormToggle";
@@ -146,15 +146,11 @@ export default function SortChildNotesDialog() {
</CardSection>
))}
- <CardSection className="sort-level-add-row">
- <Button
- className="sort-level-add"
- icon="bx-plus"
- text={t("sort_child_notes.add_level")}
- size="small"
- onClick={() => setLevels([ ...levels, NEW_LEVEL ])}
- />
- </CardSection>
+ <ItemCreationRow buttons={[ {
+ label: t("sort_child_notes.add_level"),
+ icon: "bx bx-plus",
+ onClick: () => setLevels([ ...levels, NEW_LEVEL ])
+ } ]} />
</Card>
<Card>