Skip to content

Commit 8bc7b60

Browse files
committed
Add "button" representation for the connect button
1 parent ab8bde8 commit 8bc7b60

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed

packages/compass-components/src/components/item-action-controls.tsx

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export type ItemAction<Action extends string> = {
2929
disabledDescription?: string;
3030
tooltip?: string;
3131
actionButtonClassName?: string;
32+
/** How to show the item when not collapsed into the menu */
33+
expandedPresentation?: 'icon' | 'button';
3234
};
3335

3436
export type ItemSeparator = { separator: true };
@@ -343,26 +345,42 @@ export function ItemActionGroup<Action extends string>({
343345
tooltip,
344346
tooltipProps,
345347
actionButtonClassName,
348+
expandedPresentation = 'icon',
346349
} = menuItem;
347-
const button = (
348-
<ItemActionButton
349-
key={action}
350-
glyph={icon}
351-
label={label}
352-
title={!tooltip ? label : undefined}
353-
size={iconSize}
354-
data-action={action}
355-
data-testid={actionTestId<Action>(dataTestId, action)}
356-
onClick={onClick}
357-
className={cx(
358-
actionGroupButtonStyle,
359-
iconClassName,
360-
actionButtonClassName
361-
)}
362-
style={iconStyle}
363-
disabled={isDisabled}
364-
/>
365-
);
350+
const button =
351+
expandedPresentation === 'icon' ? (
352+
<ItemActionButton
353+
key={action}
354+
glyph={icon}
355+
label={label}
356+
title={!tooltip ? label : undefined}
357+
size={iconSize}
358+
data-action={action}
359+
data-testid={actionTestId<Action>(dataTestId, action)}
360+
onClick={onClick}
361+
className={cx(
362+
actionGroupButtonStyle,
363+
iconClassName,
364+
actionButtonClassName
365+
)}
366+
style={iconStyle}
367+
disabled={isDisabled}
368+
/>
369+
) : (
370+
<Button
371+
key={action}
372+
title={!tooltip ? label : undefined}
373+
size={iconSize}
374+
data-action={action}
375+
data-testid={actionTestId<Action>(dataTestId, action)}
376+
onClick={onClick}
377+
className={actionButtonClassName}
378+
style={iconStyle}
379+
disabled={isDisabled}
380+
>
381+
{label}
382+
</Button>
383+
);
366384

367385
if (tooltip) {
368386
return (

packages/compass-connections-navigation/src/item-actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export const notConnectedConnectionItemActions = ({
146146
action: 'connection-connect',
147147
label: 'Connect',
148148
icon: 'Connect',
149+
expandedPresentation: 'button',
149150
},
150151
...commonActions,
151152
];

0 commit comments

Comments
 (0)