Skip to content

Build your personal knowledge base with Trilium Notes

style(menu): draw the submenu filter as one field with the icon inside

Elian Doranceb832d6e1b1
diff --git a/apps/client/src/widgets/react/Menu.css b/apps/client/src/widgets/react/Menu.css
index 1072d5c6a4..0da5dd724b 100644
--- a/apps/client/src/widgets/react/Menu.css
+++ b/apps/client/src/widgets/react/Menu.css
@@ -81,24 +81,35 @@ body.desktop .dropdown-item.dropdown-submenu.submenu-open,
/* The input at the top of a filterable submenu, above its rows or its matches. */
.tn-menu-filter-row {
- display: flex;
- align-items: center;
- gap: 0.5em;
- margin: 0 0.25rem 0.25rem;
- padding: 0 0.5rem 0.25rem;
- border-bottom: 1px solid var(--dropdown-border-color);
- color: var(--muted-text-color);
+ padding-bottom: 4px;
+
+ /* As wide as a row's highlight, the text where a row's icon starts, and the icon inside the
+ field at its end, as in the quick search. */
+ .tn-menu-filter-box {
+ display: flex;
+ align-items: center;
+ gap: 0.5em;
+ margin: 0;
+ padding-inline: var(--menu-item-start-padding, 8px);
+ border-radius: 6px;
+ color: var(--muted-text-color);
+ cursor: text;
+ }
- /* Bootstrap draws `.form-control` and its focus as a field; in a menu the row is the field. */
+ /* The box is the field; the input inside takes none of the field styling the theme gives
+ every text input, `.form-control` and focus included. */
.tn-menu-filter-input,
+ .tn-menu-filter-input:hover,
.tn-menu-filter-input:focus {
flex: 1;
min-width: 10em;
- padding: 0.125rem 0;
+ padding: 4px 0;
border: none;
+ outline: none;
background: transparent;
box-shadow: none;
color: var(--menu-text-color);
+ font: inherit;
}
}
diff --git a/apps/client/src/widgets/react/Menu.tsx b/apps/client/src/widgets/react/Menu.tsx
index 0344607eb7..9e280cf329 100644
--- a/apps/client/src/widgets/react/Menu.tsx
+++ b/apps/client/src/widgets/react/Menu.tsx
@@ -429,13 +429,15 @@ function MenuFilterInput({ filter }: { filter: MenuFilter }) {
return (
<li className="tn-menu-filter-row" role="none">
- <span className="bx bx-search" aria-hidden="true" />
- <FormTextBox
- inputRef={inputRef} className="tn-menu-filter-input" data-level={filter.level + 1}
- currentValue={filter.text} placeholder={t("menu.filter_placeholder")} aria-label={t("menu.filter")}
- autoComplete="off" spellcheck={false}
- onChange={(text) => menu.setFilter(text ? { rowId: filter.rowId, level: filter.level, text } : undefined)}
- />
+ <label className="tn-menu-filter-box tn-input-field">
+ <FormTextBox
+ inputRef={inputRef} className="tn-menu-filter-input" data-level={filter.level + 1}
+ currentValue={filter.text} placeholder={t("menu.filter_placeholder")} aria-label={t("menu.filter")}
+ autoComplete="off" spellcheck={false}
+ onChange={(text) => menu.setFilter(text ? { rowId: filter.rowId, level: filter.level, text } : undefined)}
+ />
+ <span className="bx bx-search" aria-hidden="true" />
+ </label>
</li>
);
}