mirror of
https://github.com/zadam/trilium.git
synced 2025-11-26 02:24:23 +01:00
refactor(react/promoted_attributes): use simplified class name handling
This commit is contained in:
parent
709a47bc6b
commit
cd164049b7
@ -115,12 +115,15 @@ function PromotedAttributeCell(props: CellProps) {
|
|||||||
}, [ props.shouldFocus ]);
|
}, [ props.shouldFocus ]);
|
||||||
|
|
||||||
let correspondingInput: ComponentChild;
|
let correspondingInput: ComponentChild;
|
||||||
|
let className: string | undefined;
|
||||||
switch (valueAttr.type) {
|
switch (valueAttr.type) {
|
||||||
case "label":
|
case "label":
|
||||||
correspondingInput = <LabelInput inputId={inputId} {...props} />;
|
correspondingInput = <LabelInput inputId={inputId} {...props} />;
|
||||||
|
className = `promoted-attribute-label-${definition.labelType}`;
|
||||||
break;
|
break;
|
||||||
case "relation":
|
case "relation":
|
||||||
correspondingInput = <RelationInput inputId={inputId} {...props} />;
|
correspondingInput = <RelationInput inputId={inputId} {...props} />;
|
||||||
|
className = "promoted-attribute-relation";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ws.logError(t(`promoted_attributes.unknown_attribute_type`, { type: valueAttr.type }));
|
ws.logError(t(`promoted_attributes.unknown_attribute_type`, { type: valueAttr.type }));
|
||||||
@ -128,8 +131,7 @@ function PromotedAttributeCell(props: CellProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx("promoted-attribute-cell",
|
<div className={clsx("promoted-attribute-cell", className)}>
|
||||||
valueAttr.type === "label" ? `promoted-attribute-label-${definition.labelType}` : "promoted-attribute-relation")}>
|
|
||||||
{definition.labelType !== "boolean" && <label for={inputId}>{definition.promotedAlias ?? valueName}</label>}
|
{definition.labelType !== "boolean" && <label for={inputId}>{definition.promotedAlias ?? valueName}</label>}
|
||||||
{correspondingInput}
|
{correspondingInput}
|
||||||
<ActionCell />
|
<ActionCell />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user