From 68864a5e72bf27807626f2cb2f5a9e7852dde4a2 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:31:43 -0500 Subject: [PATCH] feat(group): Add support for custom classname on group labels --- packages/module/src/components/groups/DefaultGroup.tsx | 2 ++ .../module/src/components/groups/DefaultGroupCollapsed.tsx | 6 ++++-- .../module/src/components/groups/DefaultGroupExpanded.tsx | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/module/src/components/groups/DefaultGroup.tsx b/packages/module/src/components/groups/DefaultGroup.tsx index 2d5d5d0..b22c2eb 100644 --- a/packages/module/src/components/groups/DefaultGroup.tsx +++ b/packages/module/src/components/groups/DefaultGroup.tsx @@ -32,6 +32,8 @@ interface DefaultGroupProps { secondaryLabel?: string; /** Flag to show the label */ showLabel?: boolean; // Defaults to true + /** Additional classes to add to the label */ + labelClassName?: string; /** Flag to show the label when hovering (effects expanded only) */ showLabelOnHover?: boolean; /** Position of the label, top or bottom. Defaults to element.getLabelPosition() or bottom */ diff --git a/packages/module/src/components/groups/DefaultGroupCollapsed.tsx b/packages/module/src/components/groups/DefaultGroupCollapsed.tsx index 5711fc8..8f58a41 100644 --- a/packages/module/src/components/groups/DefaultGroupCollapsed.tsx +++ b/packages/module/src/components/groups/DefaultGroupCollapsed.tsx @@ -44,6 +44,7 @@ type DefaultGroupCollapsedProps = { badgeBorderColor?: string; badgeClassName?: string; badgeLocation?: BadgeLocation; + labelClassName?: string; } & CollapsibleGroupProps & WithDragNodeProps & WithSelectionProps & @@ -84,7 +85,8 @@ const DefaultGroupCollapsed: React.FunctionComponent badgeLocation, labelIconClass, labelIcon, - labelIconPadding + labelIconPadding, + labelClassName }) => { const [hovered, hoverRef] = useHover(); const [labelHover, labelHoverRef] = useHover(); @@ -156,7 +158,7 @@ const DefaultGroupCollapsed: React.FunctionComponent )} {showLabel && ( = badgeBorderColor, badgeClassName, badgeLocation, + labelClassName, labelIconClass, labelIcon, labelPosition, @@ -252,7 +254,7 @@ const DefaultGroupExpanded: React.FunctionComponent = (showLabel || (showLabelOnHover && isHover)) && (label || element.getLabel()) ? (