@@ -124,6 +124,7 @@ type SignalPopoverProps = {
124
124
darkMode ?: boolean ;
125
125
onPopoverOpenChange ?: ( open : boolean ) => void ;
126
126
className ?: string ;
127
+ shouldExpandBadge ?: boolean ;
127
128
} ;
128
129
129
130
const signalCardContentStyles = css ( {
@@ -441,6 +442,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
441
442
darkMode : _darkMode ,
442
443
onPopoverOpenChange : _onPopoverOpenChange ,
443
444
className,
445
+ shouldExpandBadge,
444
446
} ) => {
445
447
const hooks = useContext ( TrackingHooksContext ) ;
446
448
const darkMode = useDarkMode ( _darkMode ) ;
@@ -449,9 +451,11 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
449
451
const [ hoverProps , isHovered , setHovered ] = useHoverState ( ) ;
450
452
const [ currentSignalIndex , setCurrentSignalIndex ] = useState ( 0 ) ;
451
453
const signals = Array . isArray ( _signals ) ? _signals : [ _signals ] ;
454
+
452
455
const currentSignal = signals [ currentSignalIndex ] ;
453
456
const multiSignals = signals . length > 1 ;
454
457
const isActive = isHovered || popoverOpen ;
458
+ const shouldShowFullBadge = isActive || shouldExpandBadge ;
455
459
456
460
const triggerRef = useRef < HTMLButtonElement > ( null ) ;
457
461
@@ -587,7 +591,9 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
587
591
] ) ,
588
592
className
589
593
) ,
590
- style : { width : isActive ? activeBadgeWidth : 18 } ,
594
+ style : {
595
+ width : shouldShowFullBadge ? activeBadgeWidth : 18 ,
596
+ } ,
591
597
ref : triggerRef ,
592
598
} ,
593
599
{ ref : guideCueRef }
@@ -604,16 +610,18 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
604
610
glyph = "Bulb"
605
611
size = "small"
606
612
className = { cx ( badgeIconStyles , badgeIconCollapsedStyles ) }
607
- style = { { opacity : isActive ? 0 : 1 } }
613
+ data-testid = "insight-badge-icon"
614
+ style = { { opacity : shouldShowFullBadge ? 0 : 1 } }
608
615
> </ Icon >
609
616
< strong
610
617
className = { cx (
611
618
badgeLabelStyles ,
612
619
! multiSignals && singleInsightBadge
613
620
) }
621
+ data-testid = "insight-badge-text"
614
622
style = { {
615
623
width : activeBadgeWidth ,
616
- opacity : isActive ? 1 : 0 ,
624
+ opacity : shouldShowFullBadge ? 1 : 0 ,
617
625
} }
618
626
>
619
627
{ badgeLabel }
0 commit comments