Skip to content

Build your personal knowledge base with Trilium Notes

style(jump-to-note): draw the search field as the dialog's heading

Elian Doran42c12ac81fbd
diff --git a/apps/client/src/stylesheets/theme-next/dialogs.css b/apps/client/src/stylesheets/theme-next/dialogs.css
index e9e0c3fd0d..c1f8a50135 100644
--- a/apps/client/src/stylesheets/theme-next/dialogs.css
+++ b/apps/client/src/stylesheets/theme-next/dialogs.css
@@ -204,6 +204,31 @@ div.tn-tool-dialog {
background: transparent !important;
}
+/*
+ * On the desktop the field is the dialog's heading, framed by the dialog itself: it holds the focus
+ * for as long as the dialog is open, so a box and a focus ring around it say nothing. On mobile the
+ * box stays, as the cue to tap.
+ */
+body.desktop .jump-to-note-dialog .input-group {
+ &,
+ &:hover,
+ &:focus-within {
+ background: transparent;
+ border-color: transparent;
+ outline: none;
+ }
+
+ .note-autocomplete-input {
+ padding-inline-start: 0;
+ font-size: 1.1rem;
+ }
+
+ /* Only while there is text to clear; hidden in place, so the field keeps its width. */
+ .note-autocomplete-input:placeholder-shown ~ .input-clearer-button {
+ visibility: hidden;
+ }
+}
+
/*
* RECENT CHANGES DIALOG
*/
diff --git a/apps/client/src/widgets/dialogs/jump_to_note.css b/apps/client/src/widgets/dialogs/jump_to_note.css
index da7e73c611..3dcb7f5c74 100644
--- a/apps/client/src/widgets/dialogs/jump_to_note.css
+++ b/apps/client/src/widgets/dialogs/jump_to_note.css
@@ -11,6 +11,13 @@
align-items: center;
}
+.jump-to-note-search-icon {
+ flex: none;
+ margin-inline-end: 8px;
+ font-size: 1.25rem;
+ color: var(--muted-text-color);
+}
+
.jump-to-note-dialog .modal-body {
padding: 0;
min-height: 200px;
diff --git a/apps/client/src/widgets/dialogs/jump_to_note.tsx b/apps/client/src/widgets/dialogs/jump_to_note.tsx
index a17391a33d..d5e9e7bea9 100644
--- a/apps/client/src/widgets/dialogs/jump_to_note.tsx
+++ b/apps/client/src/widgets/dialogs/jump_to_note.tsx
@@ -6,7 +6,9 @@ import appContext from "../../components/app_context";
import commandRegistry from "../../services/command_registry";
import { t } from "../../services/i18n";
import type { Suggestion } from "../../services/note_autocomplete";
+import { isMobile } from "../../services/utils";
import { useTriliumEvent } from "../react/hooks";
+import Icon from "../react/Icon";
import Modal from "../react/Modal";
import NoteAutocomplete, { type NoteAutocompleteHandle } from "../react/NoteAutocomplete";
import { refToJQuerySelector } from "../react/react_utils";
@@ -100,21 +102,24 @@ export default function JumpToNoteDialogComponent() {
<Modal
className="jump-to-note-dialog"
size="lg"
- title={<NoteAutocomplete
- placeholder={t("jump_to_note.search_placeholder")}
- inputRef={autocompleteRef}
- handleRef={handleRef}
- container={containerRef}
- text={initialText}
- opts={{
- allowCreatingNotes: true,
- hideGoToSelectedNoteButton: true,
- allowJumpToSearchNotes: true,
- isCommandPalette: true
- }}
- onTextChange={(text) => actualText.current = text}
- onChange={onItemSelected}
- />}
+ title={<>
+ {!isMobile() && <Icon icon="bx bx-search" className="jump-to-note-search-icon" />}
+ <NoteAutocomplete
+ placeholder={t("jump_to_note.search_placeholder")}
+ inputRef={autocompleteRef}
+ handleRef={handleRef}
+ container={containerRef}
+ text={initialText}
+ opts={{
+ allowCreatingNotes: true,
+ hideGoToSelectedNoteButton: true,
+ allowJumpToSearchNotes: true,
+ isCommandPalette: true
+ }}
+ onTextChange={(text) => actualText.current = text}
+ onChange={onItemSelected}
+ />
+ </>}
onShown={onShown}
onHidden={() => setShown(false)}
show={shown}