Skip to content

Commit

Permalink
feat: Adding Emotion ThemeProviders for all React apps (apache#9853)
Browse files Browse the repository at this point in the history
* bumping style package (now with typography styles!)

* ThemeProvider ALL the things!

* package lock

* linting

* no need to parseInt here anymore, the values are numeric now.
  • Loading branch information
rusackas authored and auxten committed Nov 20, 2020
1 parent b0733fb commit 83d838a
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 64 deletions.
92 changes: 46 additions & 46 deletions superset-frontend/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion superset-frontend/package.json
Expand Up @@ -94,7 +94,7 @@
"@superset-ui/plugin-chart-word-cloud": "^0.13.9",
"@superset-ui/preset-chart-xy": "^0.13.11",
"@superset-ui/query": "^0.13.6",
"@superset-ui/style": "^0.13.3",
"@superset-ui/style": "^0.13.11",
"@superset-ui/time-format": "^0.13.15",
"@superset-ui/translation": "^0.13.3",
"@superset-ui/validator": "^0.13.3",
Expand Down
7 changes: 5 additions & 2 deletions superset-frontend/src/SqlLab/App.jsx
Expand Up @@ -21,7 +21,8 @@ import { createStore, compose, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
import { hot } from 'react-hot-loader/root';

import { ThemeProvider } from 'emotion-theming';
import { supersetTheme } from '@superset-ui/style';
import {
initFeatureFlags,
isFeatureEnabled,
Expand Down Expand Up @@ -109,7 +110,9 @@ if (sqlLabMenu) {

const Application = () => (
<Provider store={store}>
<App />
<ThemeProvider theme={supersetTheme}>
<App />
</ThemeProvider>
</Provider>
);

Expand Down
13 changes: 8 additions & 5 deletions superset-frontend/src/SqlLab/components/App.jsx
Expand Up @@ -23,7 +23,8 @@ import { connect } from 'react-redux';
import $ from 'jquery';
import { t } from '@superset-ui/translation';
import throttle from 'lodash/throttle';

import { ThemeProvider } from 'emotion-theming';
import { supersetTheme } from '@superset-ui/style';
import TabbedSqlEditors from './TabbedSqlEditors';
import QueryAutoRefresh from './QueryAutoRefresh';
import QuerySearch from './QuerySearch';
Expand Down Expand Up @@ -132,10 +133,12 @@ class App extends React.PureComponent {
);
}
return (
<div className="App SqlLab">
{content}
<ToastPresenter />
</div>
<ThemeProvider theme={supersetTheme}>
<div className="App SqlLab">
{content}
<ToastPresenter />
</div>
</ThemeProvider>
);
}
}
Expand Down
8 changes: 7 additions & 1 deletion superset-frontend/src/addSlice/App.jsx
Expand Up @@ -18,6 +18,8 @@
*/
import React from 'react';
import { hot } from 'react-hot-loader/root';
import { ThemeProvider } from 'emotion-theming';
import { supersetTheme } from '@superset-ui/style';
import setupApp from '../setup/setupApp';
import setupPlugins from '../setup/setupPlugins';
import AddSliceContainer from './AddSliceContainer';
Expand All @@ -30,6 +32,10 @@ const bootstrapData = JSON.parse(
addSliceContainer.getAttribute('data-bootstrap'),
);

const App = () => <AddSliceContainer datasources={bootstrapData.datasources} />;
const App = () => (
<ThemeProvider theme={supersetTheme}>
<AddSliceContainer datasources={bootstrapData.datasources} />
</ThemeProvider>
);

export default hot(App);
2 changes: 1 addition & 1 deletion superset-frontend/src/components/Select/styles.tsx
Expand Up @@ -62,7 +62,7 @@ export type ThemeConfig = {
export type PartialThemeConfig = RecursivePartial<ThemeConfig>;

export const DEFAULT_THEME: PartialThemeConfig = {
borderRadius: parseInt(supersetTheme.borderRadius, 10),
borderRadius: supersetTheme.borderRadius,
zIndex: 11,
colors: {
...supersetColors,
Expand Down
6 changes: 5 additions & 1 deletion superset-frontend/src/dashboard/App.jsx
Expand Up @@ -19,6 +19,8 @@
import { hot } from 'react-hot-loader/root';
import React from 'react';
import { Provider } from 'react-redux';
import { ThemeProvider } from 'emotion-theming';
import { supersetTheme } from '@superset-ui/style';

import setupApp from '../setup/setupApp';
import setupPlugins from '../setup/setupPlugins';
Expand All @@ -29,7 +31,9 @@ setupPlugins();

const App = ({ store }) => (
<Provider store={store}>
<DashboardContainer />
<ThemeProvider theme={supersetTheme}>
<DashboardContainer />
</ThemeProvider>
</Provider>
);

Expand Down
13 changes: 8 additions & 5 deletions superset-frontend/src/explore/App.jsx
Expand Up @@ -19,9 +19,10 @@
import React from 'react';
import { hot } from 'react-hot-loader/root';
import { Provider } from 'react-redux';
import { ThemeProvider } from 'emotion-theming';
import styled, { supersetTheme } from '@superset-ui/style';
import ToastPresenter from '../messageToasts/containers/ToastPresenter';
import ExploreViewContainer from './components/ExploreViewContainer';

import setupApp from '../setup/setupApp';
import setupPlugins from '../setup/setupPlugins';
import './main.less';
Expand All @@ -32,10 +33,12 @@ setupPlugins();

const App = ({ store }) => (
<Provider store={store}>
<div>
<ExploreViewContainer />
<ToastPresenter />
</div>
<ThemeProvider theme={supersetTheme}>
<div>
<ExploreViewContainer />
<ToastPresenter />
</div>
</ThemeProvider>
</Provider>
);

Expand Down
7 changes: 5 additions & 2 deletions superset-frontend/src/profile/App.jsx
Expand Up @@ -21,7 +21,8 @@ import { hot } from 'react-hot-loader/root';
import thunk from 'redux-thunk';
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
import { Provider } from 'react-redux';

import { ThemeProvider } from 'emotion-theming';
import { supersetTheme } from '@superset-ui/style';
import App from './components/App';
import messageToastReducer from '../messageToasts/reducers';
import { initEnhancer } from '../reduxUtils';
Expand All @@ -46,7 +47,9 @@ const store = createStore(

const Application = () => (
<Provider store={store}>
<App user={bootstrap.user} />
<ThemeProvider theme={supersetTheme}>
<App user={bootstrap.user} />
</ThemeProvider>
</Provider>
);

Expand Down

0 comments on commit 83d838a

Please sign in to comment.