Skip to content

Commit

Permalink
Adds KibanaThemeProvider to Home app (elastic#119254)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
2 people authored and TinLe committed Dec 22, 2021
1 parent b551772 commit dfaa08e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/plugins/home/public/application/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { i18n } from '@kbn/i18n';
import { ScopedHistory, CoreStart } from 'kibana/public';
import { KibanaContextProvider, RedirectAppLinks } from '../../../kibana_react/public';
import { ScopedHistory, CoreStart, CoreTheme } from 'kibana/public';
import { Observable } from 'rxjs';
import {
KibanaContextProvider,
KibanaThemeProvider,
RedirectAppLinks,
} from '../../../kibana_react/public';
// @ts-ignore
import { HomeApp } from './components/home_app';
import { getServices } from './kibana_services';
Expand All @@ -19,6 +24,7 @@ import './index.scss';

export const renderApp = async (
element: HTMLElement,
theme$: Observable<CoreTheme>,
coreStart: CoreStart,
history: ScopedHistory
) => {
Expand All @@ -45,9 +51,11 @@ export const renderApp = async (

render(
<RedirectAppLinks application={coreStart.application}>
<KibanaContextProvider services={{ ...coreStart }}>
<HomeApp directories={directories} solutions={solutions} />
</KibanaContextProvider>
<KibanaThemeProvider theme$={theme$}>
<KibanaContextProvider services={{ ...coreStart }}>
<HomeApp directories={directories} solutions={solutions} />
</KibanaContextProvider>
</KibanaThemeProvider>
</RedirectAppLinks>,
element
);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class HomePublicPlugin
i18n.translate('home.pageTitle', { defaultMessage: 'Home' })
);
const { renderApp } = await import('./application');
return await renderApp(params.element, coreStart, params.history);
return await renderApp(params.element, params.theme$, coreStart, params.history);
},
});
urlForwarding.forwardApp('home', 'home');
Expand Down

0 comments on commit dfaa08e

Please sign in to comment.