[App Menu Standardization] New way to register app menu#245938
[App Menu Standardization] New way to register app menu#245938kowalczyk-krzysztof merged 50 commits intoelastic:mainfrom
Conversation
52a5c62 to
b955131
Compare
b955131 to
5020df7
Compare
31b8bbc to
3da6f65
Compare
5d1d65c to
954168a
Compare
843938b to
66adbf2
Compare
1f2815a to
f3efd69
Compare
davismcphee
left a comment
There was a problem hiding this comment.
The Discover changes are looking good! Left a couple of comments.
Thanks for checking this out @davismcphee I will probably open separate PRs for both discover and dashboards later as this one includes those changes, mostly to see if this approach would work. EDIT: Moved to: #246156 |
a2fdb05 to
94d6930
Compare
| }; | ||
|
|
||
| const discoverConfig: TopNavMenuConfigBeta = { | ||
| const discoverConfig: AppMenuConfig = { |
There was a problem hiding this comment.
I moved Storybook directly to SharedUX Stories as in current state, integrating the component with unified tabs would cause circular dependencies if the Storybook file was kept within the app menu package. Once the integration with discover tabs is complete, it will be safe to delete the discover story and move the file back to app menu package.
|
Pinging @elastic/appex-sharedux (Team:SharedUX) |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled line counts
Total ESLint disabled count
History
|
## Summary
This PR adds a new way to add app menu to applications.
### Usage:
- Declarative (preferred):
```tsx
import React, { useEffect } from 'react';
import { AppMenu } from '@kbn/core-chrome-app-menu';
import type { AppMenuConfig } from '@kbn/core-chrome-app-menu-components';
import { useKibana } from '@kbn/kibana-react-plugin/public';
interface Props {
config: AppMenuConfig;
}
const Example = ({ config }: Props) => {
const { chrome } = useKibana().services;
return <AppMenu config={config} setAppMenu={chrome.setAppMenu} />;
};
```
- Imperative:
```tsx
import React, { useEffect } from 'react';
import type { AppMenuConfig } from '@kbn/core-chrome-app-menu-components';
import { useKibana } from '@kbn/kibana-react-plugin/public';
interface Props {
config: AppMenuConfig;
}
const Example = ({ config }: Props) => {
const { chrome } = useKibana().services;
useEffect(() => {
chrome.setAppMenu(config);
}, [chrome.setAppMenu, config]);
return <div>Hello world!</div>;
};
```
- As a standalone component:
```tsx
import React, { useEffect } from 'react';
import { AppMenuComponent, type AppMenuConfig } from '@kbn/core-chrome-app-menu-components';
interface Props {
config: AppMenuConfig;
}
const Example = ({ config }: Props) => {
return <AppMenuComponent config={config} />;
};
```
Closes: elastic/kibana-team#2408
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
This PR adds a new way to add app menu to applications.
Usage:
Closes: https://github.com/elastic/kibana-team/issues/2408