Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): align the template dropdown's check mark with the menu's edge

Elian Doraneee1402a1b12
diff --git a/apps/client/src/widgets/collections/board/index.spec.tsx b/apps/client/src/widgets/collections/board/index.spec.tsx
index f4743008a9..0384c3ca2c 100644
--- a/apps/client/src/widgets/collections/board/index.spec.tsx
+++ b/apps/client/src/widgets/collections/board/index.spec.tsx
@@ -2523,7 +2523,7 @@ describe("Board column rename", () => {
"Text", "Markdown", "Canvas", "Spreadsheet", "board_view.more-templates"
]);
// The one a card would be made from is ticked, rather than standing out by its background.
- expect(items.map(item => !!item.querySelector(".template-dropdown-current")))
+ expect(items.map(item => !!item.querySelector(".menu-trailing-icon")))
.toEqual([ true, false, false, false, false ]);
expect(items.some(item => item.classList.contains("active"))).toBe(false);
@@ -2543,7 +2543,7 @@ describe("Board column rename", () => {
});
const reopened = [ ...document.querySelectorAll<HTMLElement>(".template-pill") ].at(-1);
expect([ ...(reopened?.querySelectorAll(".dropdown-item") ?? []) ]
- .map(item => !!item.querySelector(".template-dropdown-current")))
+ .map(item => !!item.querySelector(".menu-trailing-icon")))
.toEqual([ false, false, true, false, false ]);
await type(editor, "Drawn");
diff --git a/apps/client/src/widgets/react/TemplateDropdown.css b/apps/client/src/widgets/react/TemplateDropdown.css
index 2f80cf82f0..7bdec6af22 100644
--- a/apps/client/src/widgets/react/TemplateDropdown.css
+++ b/apps/client/src/widgets/react/TemplateDropdown.css
@@ -31,13 +31,3 @@
border-color: var(--main-text-color);
color: var(--main-text-color);
}
-
-.tn-dropdown-portal.template-dropdown .dropdown-item {
- display: flex;
- align-items: center;
-}
-
-.tn-dropdown-portal.template-dropdown .template-dropdown-current {
- margin-inline-start: auto;
- padding-inline-start: 1.5em;
-}
diff --git a/apps/client/src/widgets/react/TemplateDropdown.tsx b/apps/client/src/widgets/react/TemplateDropdown.tsx
index 41d22a2586..3c10eaae05 100644
--- a/apps/client/src/widgets/react/TemplateDropdown.tsx
+++ b/apps/client/src/widgets/react/TemplateDropdown.tsx
@@ -67,13 +67,10 @@ export default function TemplateDropdown({
<FormListItem
key={template.id}
icon={template.icon}
+ checked={template.id === current?.id}
onClick={() => onSelect(template)}
>
{template.title}
- {/* A check mark rather than a highlight, which reads as the row under the pointer. */}
- {template.id === current?.id && (
- <Icon className="template-dropdown-current" icon="bx bx-check" />
- )}
</FormListItem>
)), [ offered, current, onSelect ]);