Skip to content

Build your personal knowledge base with Trilium Notes

refactor(command_palette): use CSS for styles

Elian Doran37461d0eb3df
diff --git a/apps/client/src/services/note_autocomplete.ts b/apps/client/src/services/note_autocomplete.ts
index 8b5314604a..7c0ef7abd5 100644
--- a/apps/client/src/services/note_autocomplete.ts
+++ b/apps/client/src/services/note_autocomplete.ts
@@ -320,14 +320,15 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
suggestion: (suggestion) => {
if (suggestion.action === "command") {
let html = `<div class="command-suggestion">`;
- html += `<div style="position: relative;">`;
- html += `<span class="${suggestion.icon || "bx bx-terminal"}"></span> <strong>${suggestion.highlightedNotePathTitle}</strong>`;
+ html += `<div class="command-header">`;
+ html += `<span class="command-icon ${suggestion.icon || "bx bx-terminal"}"></span>`;
+ html += `<span class="command-name">${suggestion.highlightedNotePathTitle}</span>`;
if (suggestion.commandShortcut) {
- html += ` <kbd>${suggestion.commandShortcut}</kbd>`;
+ html += `<kbd class="command-shortcut">${suggestion.commandShortcut}</kbd>`;
}
html += `</div>`;
if (suggestion.commandDescription) {
- html += `<small style="color: var(--muted-text-color);">${suggestion.commandDescription}</small>`;
+ html += `<div class="command-description">${suggestion.commandDescription}</div>`;
}
html += '</div>';
return html;
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index d5742feb64..13cde9d739 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -1793,21 +1793,36 @@ textarea {
background-color: var(--hover-background-color);
}
-.jump-to-note-dialog .command-suggestion kbd {
+.jump-to-note-dialog .command-header {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ position: relative;
+}
+
+.jump-to-note-dialog .command-icon {
+ flex-shrink: 0;
+}
+
+.jump-to-note-dialog .command-name {
+ flex: 1;
+ font-weight: bold;
+}
+
+.jump-to-note-dialog .command-shortcut {
padding: 0.2rem 0.4rem;
font-size: 0.8em;
background-color: var(--button-background-color);
border: 1px solid var(--main-border-color);
border-radius: 3px;
- margin-left: 0.5rem;
- position: absolute;
- right: 1rem;
- top: 0.75rem;
+ margin-left: auto;
+ flex-shrink: 0;
}
-.jump-to-note-dialog .command-suggestion small {
- display: block;
+.jump-to-note-dialog .command-description {
margin-top: 0.25rem;
+ font-size: 0.875em;
+ color: var(--muted-text-color);
line-height: 1.3;
}