Skip to content

Build your personal knowledge base with Trilium Notes

feat(branch_prefix): improve preview style

Elian Doran364a4b605bd9
diff --git a/apps/client/src/widgets/dialogs/branch_prefix.css b/apps/client/src/widgets/dialogs/branch_prefix.css
index 3470f1018e..3602bb666b 100644
--- a/apps/client/src/widgets/dialogs/branch_prefix.css
+++ b/apps/client/src/widgets/dialogs/branch_prefix.css
@@ -1,11 +1,29 @@
-.branch-prefix-dialog .branch-prefix-notes-list {
- margin-top: 10px;
+.branch-prefix-dialog .tn-card {
+ margin-top: 16px;
}
-.branch-prefix-dialog .branch-prefix-notes-list ul {
+.branch-prefix-dialog .preview-list {
+ margin: 0;
+ padding: 0;
+ list-style: none;
max-height: 200px;
overflow: auto;
- margin-top: 5px;
+}
+
+.branch-prefix-dialog .preview-list li {
+ padding: 6px 16px;
+ border-bottom: 1px solid var(--main-border-color);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.branch-prefix-dialog .preview-list li:last-child {
+ border-bottom: none;
+}
+
+.branch-prefix-dialog .preview-list li .tn-icon {
+ margin-right: 6px;
}
.branch-prefix-dialog .branch-prefix-current {
diff --git a/apps/client/src/widgets/dialogs/branch_prefix.tsx b/apps/client/src/widgets/dialogs/branch_prefix.tsx
index 2f7fad9c06..364a18da1a 100644
--- a/apps/client/src/widgets/dialogs/branch_prefix.tsx
+++ b/apps/client/src/widgets/dialogs/branch_prefix.tsx
@@ -10,8 +10,10 @@ import server from "../../services/server.js";
import toast from "../../services/toast.js";
import tree from "../../services/tree.js";
import Button from "../react/Button.jsx";
+import { Card, CardSection } from "../react/Card.js";
import FormGroup from "../react/FormGroup.js";
import { useTriliumEvent } from "../react/hooks.jsx";
+import Icon from "../react/Icon.js";
import Modal from "../react/Modal.jsx";
// Virtual branches (e.g., from search results) start with this prefix
@@ -101,20 +103,22 @@ export default function BranchPrefixDialog() {
<input class="branch-prefix-input form-control" value={prefix} ref={branchInput}
onChange={(e) => setPrefix((e.target as HTMLInputElement).value)} />
</FormGroup>
- <div className="branch-prefix-notes-list">
- <strong>{t("branch_prefix.preview_in_tree")}</strong>
- <ul>
- {branches.map((branch) => {
- const note = branch.getNoteFromCache();
- return note && (
- <li key={branch.branchId}>
- {prefix && <span className="branch-prefix-current">{prefix} - </span>}
- {note.title}
- </li>
- );
- })}
- </ul>
- </div>
+ <Card heading={t("branch_prefix.preview_in_tree")}>
+ <CardSection noPadding>
+ <ul className="preview-list">
+ {branches.map((branch) => {
+ const note = branch.getNoteFromCache();
+ return note && (
+ <li key={branch.branchId}>
+ <Icon icon={note.getIcon()} />
+ {prefix && <span className="branch-prefix-current">{prefix} - </span>}
+ {note.title}
+ </li>
+ );
+ })}
+ </ul>
+ </CardSection>
+ </Card>
</Modal>
);
}