Align badge in tree

Reviewed By: lblasa

Differential Revision: D47520030

fbshipit-source-id: 01466aff57d048a50803366957396abeb76d5649
This commit is contained in:
Luke De Feo
2023-07-19 08:58:20 -07:00
committed by Facebook GitHub Bot
parent 34f6b100d7
commit 9d0b8ac0fe

View File

@@ -70,7 +70,6 @@ export type TreeNode = UINode & {
isExpanded: boolean; isExpanded: boolean;
indentGuide: NodeIndentGuide | null; indentGuide: NodeIndentGuide | null;
}; };
export function Tree2({nodes, rootId}: {nodes: Map<Id, UINode>; rootId: Id}) { export function Tree2({nodes, rootId}: {nodes: Map<Id, UINode>; rootId: Id}) {
const instance = usePlugin(plugin); const instance = usePlugin(plugin);
const focusedNode = useValue(instance.uiState.focusedNode); const focusedNode = useValue(instance.uiState.focusedNode);
@@ -364,17 +363,16 @@ function TreeItemContainer({
}} }}
/> />
{nodeIcon(treeNode)} {nodeIcon(treeNode)}
{events ? (
<TreeItemRowContent treeNode={treeNode} />
{events && (
<Badge <Badge
key={treeNode.id}
count={events.length} count={events.length}
size="small" style={{
color={theme.primaryColor} backgroundColor: theme.primaryColor,
offset={[10, 5]}> marginLeft: theme.space.small,
<TreeItemRowContent treeNode={treeNode} /> }}
</Badge> />
) : (
<TreeItemRowContent treeNode={treeNode} />
)} )}
</TreeItemRow> </TreeItemRow>
</div> </div>