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
Browse files Browse the repository at this point in the history
Export ThemeProvider and useTheme from emotion-theming since they are
almost always used together with supersetTheme. This makes importing and
package dependencies in Superset app (and dependent plugins) easier.
  • Loading branch information
ktmud committed May 30, 2020
1 parent 67b5d75 commit 44be3bd
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 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"
}
}
2 changes: 2 additions & 0 deletions packages/superset-ui-style/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ export const supersetTheme = defaultTheme;
export interface SupersetThemeProps {
theme: typeof defaultTheme;
}

export { useTheme, ThemeProvider, withTheme } from 'emotion-theming';
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

0 comments on commit 44be3bd

Please sign in to comment.