Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
feat(superset-ui-style): export ThemeProvider and useTheme (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud authored Jun 1, 2020
1 parent 67b5d75 commit f6a8949
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
3 changes: 1 addition & 2 deletions packages/superset-ui-demo/.storybook/themeDecorator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// themeDecorator.js
import React from "react"
import { ThemeProvider } from 'emotion-theming';
import { supersetTheme } from '@superset-ui/style';
import { supersetTheme, ThemeProvider } from '@superset-ui/style';

const ThemeDecorator = storyFn => (
<ThemeProvider theme={supersetTheme}>{storyFn()}</ThemeProvider>
Expand Down
3 changes: 1 addition & 2 deletions packages/superset-ui-style/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Provides a style object containing a variety of style parameters for theming Sup
## Usage

```ts
import { ThemeProvider } from 'emotion-theming';
import styled, { supersetTheme } from '@superset-ui/style';
import { styled, supersetTheme, ThemeProvider } from '@superset-ui/style';

// use emotion api as normal, but the theme uses the correct types
const MyHeader = styled.h1`
Expand Down
3 changes: 2 additions & 1 deletion packages/superset-ui-style/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"dependencies": {
"@emotion/core": "^10.0.28",
"@emotion/styled": "^10.0.27"
"@emotion/styled": "^10.0.27",
"emotion-theming": "^10.0.27"
}
}
13 changes: 8 additions & 5 deletions packages/superset-ui-style/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
import styled, { CreateStyled } from '@emotion/styled';
import emotionStyled, { CreateStyled } from '@emotion/styled';

export { useTheme, ThemeProvider, withTheme } from 'emotion-theming';

const defaultTheme = {
borderRadius: 4,
Expand Down Expand Up @@ -60,10 +62,11 @@ const defaultTheme = {
gridUnit: 4,
};

export default styled as CreateStyled<typeof defaultTheme>;

export const supersetTheme = defaultTheme;

export interface SupersetThemeProps {
theme: typeof defaultTheme;
}

export const styled: CreateStyled<typeof defaultTheme> = emotionStyled;
export const supersetTheme = defaultTheme;

export default styled;
1 change: 0 additions & 1 deletion plugins/plugin-chart-word-cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"@types/react": "^16.3.0",
"d3-cloud": "^1.2.5",
"d3-scale": "^3.0.1",
"emotion-theming": "^10.0.27",
"encodable": "^0.3.3"
},
"peerDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions plugins/plugin-chart-word-cloud/src/chart/WordCloud.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import cloudLayout, { Word } from 'd3-cloud';
import { PlainObject, createEncoderFactory, DeriveEncoding } from 'encodable';
import { SupersetThemeProps } from '@superset-ui/style';
import { withTheme } from 'emotion-theming';
import { SupersetThemeProps, withTheme } from '@superset-ui/style';

export const ROTATION = {
flat: () => 0,
Expand Down

1 comment on commit f6a8949

@vercel
Copy link

@vercel vercel bot commented on f6a8949 Jun 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.