Skip to content

Commit e9f40c4

Browse files
committed
feat(board/promoted_attributes): basic support for color attributes
1 parent 6b74b22 commit e9f40c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { DefinitionObject } from "../../services/promoted_attribute_definition_p
77
import { formatDateTime } from "../../utils/formatters";
88
import { ComponentChildren } from "preact";
99
import Icon from "../react/Icon";
10+
import css_class_manager from "../../services/css_class_manager";
1011

1112
interface PromotedAttributesDisplayProps {
1213
note: FNote;
@@ -26,8 +27,9 @@ export default function PromotedAttributesDisplay({ note, ignoredAttributes }: P
2627
return promotedDefinitionAttributes?.length > 0 && (
2728
<div className="promoted-attributes">
2829
{promotedDefinitionAttributes?.map((attr) => {
30+
const className = `${attr.type === "label" ? "label" + " " + attr.def.labelType : "relation"}`;
2931
return (
30-
<span key={attr.friendlyName} className="promoted-attribute">
32+
<span key={attr.friendlyName} className={`promoted-attribute type-${className}`}>
3133
{formatLabelValue(attr)}
3234
</span>
3335
);
@@ -74,6 +76,8 @@ function formatLabelValue(attr: AttributeWithDefinitions): ComponentChildren {
7476
return <><Icon icon={value === "true" ? "bx bx-check-square" : "bx bx-square"} /> <strong>{attr.friendlyName}</strong></>;
7577
case "url":
7678
return <><a href={value} target="_blank" rel="noopener noreferrer">{attr.friendlyName}</a></>;
79+
case "color":
80+
return <><span style={{ color: value }}>{attr.friendlyName}</span></>;
7781
case "text":
7882
default:
7983
return <><strong>{attr.friendlyName}:</strong> {value}</>;

0 commit comments

Comments
 (0)