@@ -124,6 +124,7 @@ type SignalPopoverProps = {
124124 darkMode ?: boolean ;
125125 onPopoverOpenChange ?: ( open : boolean ) => void ;
126126 className ?: string ;
127+ shouldExpandBadge ?: boolean ;
127128} ;
128129
129130const signalCardContentStyles = css ( {
@@ -441,6 +442,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
441442 darkMode : _darkMode ,
442443 onPopoverOpenChange : _onPopoverOpenChange ,
443444 className,
445+ shouldExpandBadge,
444446} ) => {
445447 const hooks = useContext ( TrackingHooksContext ) ;
446448 const darkMode = useDarkMode ( _darkMode ) ;
@@ -449,9 +451,11 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
449451 const [ hoverProps , isHovered , setHovered ] = useHoverState ( ) ;
450452 const [ currentSignalIndex , setCurrentSignalIndex ] = useState ( 0 ) ;
451453 const signals = Array . isArray ( _signals ) ? _signals : [ _signals ] ;
454+
452455 const currentSignal = signals [ currentSignalIndex ] ;
453456 const multiSignals = signals . length > 1 ;
454457 const isActive = isHovered || popoverOpen ;
458+ const shouldShowFullBadge = isActive || shouldExpandBadge ;
455459
456460 const triggerRef = useRef < HTMLButtonElement > ( null ) ;
457461
@@ -587,7 +591,9 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
587591 ] ) ,
588592 className
589593 ) ,
590- style : { width : isActive ? activeBadgeWidth : 18 } ,
594+ style : {
595+ width : shouldShowFullBadge ? activeBadgeWidth : 18 ,
596+ } ,
591597 ref : triggerRef ,
592598 } ,
593599 { ref : guideCueRef }
@@ -604,16 +610,18 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
604610 glyph = "Bulb"
605611 size = "small"
606612 className = { cx ( badgeIconStyles , badgeIconCollapsedStyles ) }
607- style = { { opacity : isActive ? 0 : 1 } }
613+ data-testid = "insight-badge-icon"
614+ style = { { opacity : shouldShowFullBadge ? 0 : 1 } }
608615 > </ Icon >
609616 < strong
610617 className = { cx (
611618 badgeLabelStyles ,
612619 ! multiSignals && singleInsightBadge
613620 ) }
621+ data-testid = "insight-badge-text"
614622 style = { {
615623 width : activeBadgeWidth ,
616- opacity : isActive ? 1 : 0 ,
624+ opacity : shouldShowFullBadge ? 1 : 0 ,
617625 } }
618626 >
619627 { badgeLabel }
0 commit comments