Skip to content

Commit e152af1

Browse files
Design changes
1 parent 1ecaafd commit e152af1

File tree

6 files changed

+72
-61
lines changed

6 files changed

+72
-61
lines changed

src/platform/plugins/shared/navigation/public/top_nav_menu/create_top_nav_menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ export function createTopNav(
4949
...(props.config as TopNavMenuPropsBeta<QT>['config'])!.items,
5050
...relevantConfig,
5151
],
52-
actionItem: (props.config as TopNavMenuPropsBeta<QT>['config'])!.actionItem,
52+
primaryActionItem: (props.config as TopNavMenuPropsBeta<QT>['config'])!
53+
.primaryActionItem,
54+
secondaryActionItem: (props.config as TopNavMenuPropsBeta<QT>['config'])!
55+
.secondaryActionItem,
56+
enableShowMoreButton: (props.config as TopNavMenuPropsBeta<QT>['config'])!
57+
.enableShowMoreButton,
5358
}
5459
: { items: relevantConfig }
5560
}

src/platform/plugins/shared/navigation/public/top_nav_menu/top_nav_menu_data.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import type { EuiButtonProps, EuiBetaBadgeProps, IconType } from '@elastic/eui';
10+
import type { EuiButtonProps, EuiBetaBadgeProps, IconType, EuiButtonColor } from '@elastic/eui';
1111
import type { InjectedIntl } from '@kbn/i18n-react';
1212
import type { SplitButtonProps } from '@kbn/split-button';
1313

@@ -52,7 +52,6 @@ export type TopNavMenuSplitButtonProps = Pick<
5252
| 'secondaryButtonAriaLabel'
5353
| 'secondaryButtonTitle'
5454
| 'iconType'
55-
| 'iconOnly'
5655
> & {
5756
run: TopNavMenuAction;
5857
};
@@ -67,20 +66,21 @@ export interface TopNavMenuItemCommonBeta {
6766
isLoading?: boolean;
6867
target?: string;
6968
href?: string;
69+
iconType?: IconType;
7070
}
7171

72-
export interface TopNavMenuItemBeta extends TopNavMenuItemCommonBeta {
73-
isExternalLink?: boolean;
74-
}
72+
export type TopNavMenuItemBeta = TopNavMenuItemCommonBeta;
7573

7674
export interface TopNavMenuActionItemBeta extends TopNavMenuItemCommonBeta {
7775
splitButtonProps?: TopNavMenuSplitButtonProps;
78-
iconType?: IconType;
76+
color?: EuiButtonColor;
7977
}
8078

8179
export interface TopNavMenuDataBeta {
8280
items: TopNavMenuItemBeta[];
83-
actionItem?: TopNavMenuActionItemBeta;
81+
enableShowMoreButton?: boolean;
82+
secondaryActionItem?: TopNavMenuActionItemBeta;
83+
primaryActionItem?: TopNavMenuActionItemBeta;
8484
}
8585

8686
export interface RegisteredTopNavMenuDataBeta extends TopNavMenuItemBeta {

src/platform/plugins/shared/navigation/public/top_nav_menu_beta/top_nav_menu_action_button.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ interface TopNavMenuActionButtonProps extends TopNavMenuActionItemBeta {
2020
}
2121

2222
export const TopNavMenuActionButton = ({
23+
run,
24+
htmlId,
2325
label,
26+
testId,
27+
iconType,
2428
disableButton,
25-
isMobileMenu,
2629
href,
27-
splitButtonProps,
28-
htmlId,
29-
testId,
30-
isLoading,
3130
target,
32-
run,
31+
isLoading,
32+
color,
33+
splitButtonProps,
34+
isMobileMenu,
3335
closePopover,
3436
}: TopNavMenuActionButtonProps) => {
3537
const itemText = upperFirst(label);
@@ -58,16 +60,18 @@ export const TopNavMenuActionButton = ({
5860
};
5961

6062
const commonProps = {
61-
size: 's' as const,
6263
onClick: href ? undefined : handleClick,
63-
isDisabled: isDisabled(),
6464
id: htmlId,
6565
'data-test-subj': testId,
66-
isLoading,
67-
fill: false,
68-
color: 'text' as const,
66+
iconType,
67+
isDisabled: isDisabled(),
6968
href,
7069
target: href ? target : undefined,
70+
isLoading,
71+
color,
72+
size: 's' as const,
73+
iconSize: 'm' as const,
74+
fill: false,
7175
};
7276

7377
if (splitButtonProps) {

src/platform/plugins/shared/navigation/public/top_nav_menu_beta/top_nav_menu_beta.stories.tsx

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -71,50 +71,45 @@ const createEditModeConfig = (): TopNavMenuDataBeta => {
7171
return {
7272
items: [
7373
{
74-
id: 'settings',
75-
label: 'Settings',
76-
run: action('settings-clicked'),
77-
testId: 'settingsButton',
78-
disableButton: false,
79-
},
80-
{
81-
id: 'cancel',
82-
label: 'Exit edit',
83-
run: action('switch-to-view-clicked'),
84-
testId: 'switchToViewButton',
85-
disableButton: false,
74+
run: action('exit-edit-clicked'),
75+
id: 'exitEdit',
76+
label: 'exit edit',
77+
testId: 'exitEditButton',
78+
iconType: 'exit', // use 'logOut' when added to EUI
8679
},
8780
{
81+
run: action('export-clicked'),
8882
id: 'export',
8983
label: 'export',
90-
run: action('export-clicked'),
9184
testId: 'exportButton',
92-
disableButton: false,
85+
iconType: 'download',
9386
},
9487
{
88+
run: action('share-clicked'),
9589
id: 'share',
9690
label: 'share',
97-
run: action('share-clicked'),
9891
testId: 'shareButton',
99-
disableButton: false,
100-
},
101-
{
102-
id: 'add',
103-
label: 'add',
104-
run: action('share-clicked'),
105-
testId: 'shareButton',
106-
disableButton: false,
92+
iconType: 'share',
10793
},
10894
],
109-
actionItem: {
110-
id: 'save',
111-
label: 'Save',
95+
secondaryActionItem: {
11296
run: action('add-clicked'),
97+
id: 'add',
98+
label: 'add',
11399
testId: 'addButton',
100+
iconType: 'plusInCircle',
101+
color: 'success',
102+
},
103+
primaryActionItem: {
104+
run: action('save-clicked'),
105+
id: 'save',
106+
label: 'save',
107+
testId: 'saveButton',
108+
iconType: 'save',
109+
color: 'text',
114110
splitButtonProps: {
115111
run: action('add-split-clicked'),
116-
secondaryButtonAriaLabel: 'Add options',
117-
isMainButtonDisabled: true,
112+
secondaryButtonAriaLabel: 'Save options',
118113
},
119114
},
120115
};
@@ -126,7 +121,7 @@ const unsavedChangesBadge: TopNavMenuBadgeProps = {
126121
color: '#F6E58D',
127122
toolTipProps: {
128123
content:
129-
' You have unsaved changes in this dashboard. To remove this label, save the dashboard.',
124+
'You have unsaved changes in this dashboard. To remove this label, save the dashboard.',
130125
position: 'bottom',
131126
} as EuiToolTipProps,
132127
};

src/platform/plugins/shared/navigation/public/top_nav_menu_beta/top_nav_menu_item_beta.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ export interface TopNavMenuItemBetaProps extends TopNavMenuItemBetaInterface {
1818
}
1919

2020
export const TopNavMenuItemBeta = ({
21+
run,
22+
htmlId,
2123
label,
24+
testId,
25+
iconType,
2226
disableButton,
23-
isMobileMenu,
2427
href,
2528
target,
26-
htmlId,
27-
testId,
2829
isLoading,
29-
isExternalLink,
30-
run,
30+
isMobileMenu,
3131
closePopover,
3232
}: TopNavMenuItemBetaProps) => {
3333
const itemText = upperFirst(label);
@@ -46,17 +46,17 @@ export const TopNavMenuItemBeta = ({
4646

4747
return (
4848
<EuiHeaderLink
49-
size="s"
5049
onClick={href ? undefined : handleClick}
51-
isDisabled={isDisabled()}
5250
id={htmlId}
5351
data-test-subj={testId}
54-
isLoading={isLoading}
55-
iconSide="right"
52+
iconType={iconType}
53+
isDisabled={isDisabled()}
5654
href={href}
5755
target={href ? target : undefined}
58-
iconSize="s"
59-
iconType={isExternalLink ? 'popout' : undefined}
56+
isLoading={isLoading}
57+
size="s"
58+
iconSide="left"
59+
iconSize="m"
6060
>
6161
{itemText}
6262
</EuiHeaderLink>

src/platform/plugins/shared/navigation/public/top_nav_menu_beta/top_nav_menu_items_beta.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,16 @@ export const TopNavMenuItemsBeta = ({
5252
/>
5353
);
5454
})}
55-
{config.actionItem && (
55+
{config.secondaryActionItem && (
5656
<TopNavMenuActionButton
57-
{...config.actionItem}
57+
{...config.secondaryActionItem}
58+
closePopover={closePopover}
59+
isMobileMenu={isMobileMenu}
60+
/>
61+
)}
62+
{config.primaryActionItem && (
63+
<TopNavMenuActionButton
64+
{...config.primaryActionItem}
5865
closePopover={closePopover}
5966
isMobileMenu={isMobileMenu}
6067
/>

0 commit comments

Comments
 (0)