File tree Expand file tree Collapse file tree 2 files changed +38
-19
lines changed
compass-components/src/components
compass-connections-navigation/src Expand file tree Collapse file tree 2 files changed +38
-19
lines changed Original file line number Diff line number Diff 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
3436export 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 (
Original file line number Diff line number Diff 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 ] ;
You can’t perform that action at this time.
0 commit comments