Skip to content

Commit 0c5adce

Browse files
committed
fix(board): no promoted attributes creates margin
1 parent b11b3ff commit 0c5adce

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ interface AttributeWithDefinitions {
1414
}
1515

1616
export default function PromotedAttributesDisplay({ note, ignoredAttributes }: PromotedAttributesDisplayProps) {
17-
const promotedDefinitionAttributes = useNoteAttributesWithDefinitions(note);
17+
const promotedDefinitionAttributes = useNoteAttributesWithDefinitions(note, ignoredAttributes);
1818
return promotedDefinitionAttributes?.length > 0 && (
1919
<div className="promoted-attributes">
2020
{promotedDefinitionAttributes?.map((attr) => {
21-
if (ignoredAttributes && ignoredAttributes.includes(attr.name)) return null;
22-
2321
return (
2422
<span key={attr.friendlyName} className="promoted-attribute">
2523
<strong>{attr.friendlyName}:</strong> {attr.value}
@@ -32,7 +30,7 @@ export default function PromotedAttributesDisplay({ note, ignoredAttributes }: P
3230

3331
}
3432

35-
function useNoteAttributesWithDefinitions(note: FNote) {
33+
function useNoteAttributesWithDefinitions(note: FNote, attributesToIgnore: string[] = []): AttributeWithDefinitions[] {
3634
const promotedDefinitionAttributes = note.getPromotedDefinitionAttributes();
3735
const result: AttributeWithDefinitions[] = [];
3836

@@ -42,6 +40,7 @@ function useNoteAttributesWithDefinitions(note: FNote) {
4240
const value = note.getLabelValue(name);
4341
const friendlyName = def?.promotedAlias ?? name;
4442
if (!value) continue;
43+
if (attributesToIgnore.includes(name)) continue;
4544

4645
result.push({ name, type, friendlyName, value });
4746
}

0 commit comments

Comments
 (0)