Skip to content

Commit 181a9a0

Browse files
authored
feat: revert nudge back to icon on default and expand on hover CLOUDP-319356 (#6940)
have the icon show up as default and show full on expand
1 parent 714455f commit 181a9a0

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

packages/compass-components/src/components/signal-popover.spec.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,6 @@ describe('SignalPopover', function () {
5151
});
5252
});
5353

54-
it('should show insights badge text by default if shouldExpandBadge is true', function () {
55-
const { rerender } = render(
56-
<SignalPopover signals={signals[0]} shouldExpandBadge={false} />
57-
);
58-
59-
// opacity: 0 means that the text will not show up
60-
expect(screen.getByTestId('insight-badge-text').style.opacity).to.equal(
61-
'0'
62-
);
63-
64-
rerender(<SignalPopover signals={signals[0]} shouldExpandBadge={true} />);
65-
// opacity: 1 means that the text will show up
66-
expect(screen.getByTestId('insight-badge-text').style.opacity).to.equal(
67-
'1'
68-
);
69-
});
70-
7154
describe('SignalHooksProvider', function () {
7255
it('should call hooks through the signal lifecycle', function () {
7356
const hooks: React.ComponentProps<typeof SignalHooksProvider> = {

packages/compass-components/src/components/signal-popover.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ type SignalPopoverProps = {
124124
darkMode?: boolean;
125125
onPopoverOpenChange?: (open: boolean) => void;
126126
className?: string;
127-
shouldExpandBadge?: boolean;
128127
};
129128

130129
const signalCardContentStyles = css({
@@ -442,7 +441,6 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
442441
darkMode: _darkMode,
443442
onPopoverOpenChange: _onPopoverOpenChange,
444443
className,
445-
shouldExpandBadge,
446444
}) => {
447445
const hooks = useContext(TrackingHooksContext);
448446
const darkMode = useDarkMode(_darkMode);
@@ -455,7 +453,6 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
455453
const currentSignal = signals[currentSignalIndex];
456454
const multiSignals = signals.length > 1;
457455
const isActive = isHovered || popoverOpen;
458-
const shouldShowFullBadge = isActive || shouldExpandBadge;
459456

460457
const triggerRef = useRef<HTMLButtonElement>(null);
461458

@@ -592,7 +589,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
592589
className
593590
),
594591
style: {
595-
width: shouldShowFullBadge ? activeBadgeWidth : 18,
592+
width: isActive ? activeBadgeWidth : 18,
596593
},
597594
ref: triggerRef,
598595
},
@@ -611,7 +608,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
611608
size="small"
612609
className={cx(badgeIconStyles, badgeIconCollapsedStyles)}
613610
data-testid="insight-badge-icon"
614-
style={{ opacity: shouldShowFullBadge ? 0 : 1 }}
611+
style={{ opacity: isActive ? 0 : 1 }}
615612
></Icon>
616613
<strong
617614
className={cx(
@@ -621,7 +618,7 @@ const SignalPopover: React.FunctionComponent<SignalPopoverProps> = ({
621618
data-testid="insight-badge-text"
622619
style={{
623620
width: activeBadgeWidth,
624-
opacity: shouldShowFullBadge ? 1 : 0,
621+
opacity: isActive ? 1 : 0,
625622
}}
626623
>
627624
{badgeLabel}

packages/compass-crud/src/components/crud-toolbar.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@ const CrudToolbar: React.FunctionComponent<CrudToolbarProps> = ({
258258
onClick={onDeleteButtonClicked}
259259
></DeleteMenu>
260260
)}
261-
{insights && (
262-
<SignalPopover signals={insights} shouldExpandBadge={true} />
263-
)}
261+
{insights && <SignalPopover signals={insights} />}
264262
</div>
265263
<div className={toolbarRightActionStyles}>
266264
<Select

0 commit comments

Comments
 (0)