Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(attributes): stop framing a dropdown in an input group
Elian Doranef6e87314c35
diff --git a/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx b/apps/client/src/widgets/attribute_widgets/attribute_detail.tsxindex b50b6b3a9c..6102b7f68a 100644--- a/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx+++ b/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx@@ -2,7 +2,7 @@ import "./attribute_detail.css";import "./attribute_name_suggestion.css";import { type DefinitionObject, type LabelType, promotedAttributeDefinitionParser } from "@triliumnext/commons";-import { ComponentProps } from "preact";+import { ComponentChildren, ComponentProps } from "preact";import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";import appContext from "../../components/app_context.js";@@ -547,7 +547,7 @@ export function AttributeForm({ opts, attrType: initialAttrType, currentNoteId,{attrType === "label" && (<OptionsRow name="attr-value" label={t("attribute_detail.value")}>{typedInput ? (- <div className="input-group">+ <TypedValueField isSelect={typedInput.labelType === "select"}><LabelValueInputlabelType={typedInput.labelType}selectOptions={typedInput.selectOptions}@@ -565,7 +565,7 @@ export function AttributeForm({ opts, attrType: initialAttrType, currentNoteId,})}}/>- </div>+ </TypedValueField>) : (<FormAutocompleteclassName="attr-input-value"@@ -741,6 +741,19 @@ export function AttributeForm({ opts, attrType: initialAttrType, currentNoteId,);}+/**+ * Wraps the value field in the group that frames it together with the buttons beside it — a colour's+ * picker and its reset, a link's open button — which is what an input group is for.+ *+ * A dropdown is handed straight through instead. It has no buttons to be grouped with, and the themes+ * dress a bare one completely: the group would draw a second frame around it, and, since it blanks the+ * background of the fields inside it so that its own shows through, would take with it the arrow the+ * themes draw on that very background — leaving a dropdown that does not look like one.+ */+function TypedValueField({ isSelect, children }: { isSelect: boolean; children: ComponentChildren }) {+ return isSelect ? <>{children}</> : <div className="input-group">{children}</div>;+}+/*** The name field and, for a name Trilium attaches a meaning to, the button explaining what it does. The* explanations run to several lines and most names have none, so they are not shown under the field.