*/
import { getIdentityProviders } from '@sqapi/users';
import * as React from 'react';
-import ThemeContext from 'sonar-ui-common/components/ThemeContext';
+import { ThemeConsumer } from 'sonar-ui-common/components/theme';
import { getTextColor } from 'sonar-ui-common/helpers/colors';
import { getBaseUrl } from 'sonar-ui-common/helpers/urls';
import LoginLink from './LoginLink';
{identityProviders && (
<section className="oauth-providers">
{vstsProvider && (
- <ThemeContext.Consumer>
- {({ theme }) => (
+ <ThemeConsumer>
+ {theme => (
<LoginLink
onReload={onReload}
sessionUrl={`sessions/init/${vstsProvider.key}`}
<span>{vstsProvider.name} log in</span>
</LoginLink>
)}
- </ThemeContext.Consumer>
+ </ThemeConsumer>
)}
</section>
)}
import { parse } from 'querystring';
import React from 'react';
import { render } from 'react-dom';
-import ThemeContext from 'sonar-ui-common/components/ThemeContext';
+import { ThemeProvider } from 'sonar-ui-common/components/theme';
import * as theme from '../../../../sonar-web/src/main/js/app/theme';
import Configuration from './components/Configuration';
import Widget from './components/Widget';
if (query.type === 'configuration') {
render(
- <ThemeContext.Provider value={{ theme }}>
+ <ThemeProvider theme={theme}>
<Configuration contribution={query.contribution} widgetHelpers={WidgetHelpers} />
- </ThemeContext.Provider>,
+ </ThemeProvider>,
container
);
} else {
return widgetSettings => {
try {
render(
- <ThemeContext.Provider value={{ theme }}>
+ <ThemeProvider theme={theme}>
<Widget settings={parseWidgetSettings(widgetSettings)} />
- </ThemeContext.Provider>,
+ </ThemeProvider>,
container
);
} catch (error) {
import { Provider } from 'react-redux';
import { IndexRoute, Redirect, Route, RouteConfig, RouteProps, Router } from 'react-router';
import { lazyLoad } from 'sonar-ui-common/components/lazyLoad';
-import ThemeContext from 'sonar-ui-common/components/ThemeContext';
+import { ThemeProvider } from 'sonar-ui-common/components/theme';
import getHistory from 'sonar-ui-common/helpers/getHistory';
import aboutRoutes from '../../apps/about/routes';
import accountRoutes from '../../apps/account/routes';
render(
<Provider store={store}>
<IntlProvider defaultLocale={lang} locale={lang}>
- <ThemeContext.Provider value={{ theme }}>
+ <ThemeProvider theme={theme}>
<Router history={history} onUpdate={handleUpdate}>
<Route
path="/account/issues"
</Route>
</Route>
</Router>
- </ThemeContext.Provider>
+ </ThemeProvider>
</IntlProvider>
</Provider>,
el