Skip to content

Build your personal knowledge base with Trilium Notes

fix(search): stack the parameters on a narrow card

Elian Doranb9b3d4065062
diff --git a/apps/client/src/widgets/search/SearchDefinition.css b/apps/client/src/widgets/search/SearchDefinition.css
index 0ca13fd376..443a3fd8ba 100644
--- a/apps/client/src/widgets/search/SearchDefinition.css
+++ b/apps/client/src/widgets/search/SearchDefinition.css
@@ -1,4 +1,6 @@
.search-definition-widget {
+ --search-title-column: 12em;
+
.search-definition-add {
display: flex;
flex-wrap: wrap;
@@ -18,7 +20,7 @@
.search-option {
display: grid;
- grid-template-columns: 12em minmax(0, 1fr) auto;
+ grid-template-columns: var(--search-title-column) minmax(0, 1fr) auto;
align-items: center;
column-gap: 12px;
row-gap: 4px;
@@ -69,32 +71,25 @@
flex: 1 1 auto;
}
- .search-option-fields > :is(.search-string, .input-group, .search-option-row) {
+ .search-option.orderBy .form-select:last-of-type {
+ flex: 0 0 auto;
+ }
+
+ .search-option-fields > :is(.search-string, .input-group) {
flex: 1 1 16rem;
}
/* The bulk action rows share the option rows' title column. */
.bulk-existing-action-list .title-column {
- width: calc(12em + 12px);
+ width: calc(var(--search-title-column) + 12px);
white-space: normal;
}
- .search-option-row {
- display: flex;
- align-items: center;
- gap: 8px;
- min-width: 0;
- }
-
- .search-option-row .input-group {
- flex: 1 1 auto;
- }
-
- .search-option-row-label {
+ .search-option-field-label {
white-space: nowrap;
}
- .search-option.limit .search-option-row .form-control {
+ .search-option.limit .form-control {
flex: 0 0 6em;
}
@@ -130,7 +125,7 @@ body.mobile .search-definition-widget {
}
@container (width < 560px) {
- .search-option {
+ .search-definition-widget .search-option {
grid-template-columns: minmax(0, 1fr) auto;
> .search-option-label {
diff --git a/apps/client/src/widgets/search/SearchDefinitionOptions.tsx b/apps/client/src/widgets/search/SearchDefinitionOptions.tsx
index 086b707f7d..6af351f239 100644
--- a/apps/client/src/widgets/search/SearchDefinitionOptions.tsx
+++ b/apps/client/src/widgets/search/SearchDefinitionOptions.tsx
@@ -289,21 +289,19 @@ function AncestorOption({ note, ...restProps}: SearchOptionProps) {
title={t("ancestor.label")}
note={note} {...restProps}
>
- <div className="search-option-row">
- <NoteAutocomplete
- noteId={ancestor !== "root" ? ancestor ?? undefined : undefined}
- noteIdChanged={noteId => setAncestor(noteId ?? "root")}
- placeholder={t("ancestor.placeholder")}
- />
+ <NoteAutocomplete
+ noteId={ancestor !== "root" ? ancestor ?? undefined : undefined}
+ noteIdChanged={noteId => setAncestor(noteId ?? "root")}
+ placeholder={t("ancestor.placeholder")}
+ />
- <span className="search-option-row-label">{t("ancestor.depth_label")}</span>
- <FormSelect
- className="w-auto"
- values={options}
- keyProperty="value" titleProperty="label"
- currentValue={depth ?? ""} onChange={(value) => setDepth(value ? value : null)}
- />
- </div>
+ <span className="search-option-field-label">{t("ancestor.depth_label")}</span>
+ <FormSelect
+ className="w-auto"
+ values={options}
+ keyProperty="value" titleProperty="label"
+ currentValue={depth ?? ""} onChange={(value) => setDepth(value ? value : null)}
+ />
</SearchOption>;
}
@@ -381,12 +379,10 @@ function LimitOption({ note, defaultValue, ...restProps }: SearchOptionProps) {
title={t("limit.limit")}
note={note} {...restProps}
>
- <div className="search-option-row">
- <FormTextBox
- type="number" min="1" step="1"
- currentValue={limit ?? defaultValue} onChange={setLimit}
- />
- <span className="search-option-row-label">{t("limit.max_results")}</span>
- </div>
+ <FormTextBox
+ type="number" min="1" step="1"
+ currentValue={limit ?? defaultValue} onChange={setLimit}
+ />
+ <span className="search-option-field-label">{t("limit.max_results")}</span>
</SearchOption>;
}