From 89514c7085f3effc14a5e80aa1cab5ec782a25e0 Mon Sep 17 00:00:00 2001 From: Jesse Yang Date: Fri, 29 May 2020 18:56:06 -0700 Subject: [PATCH] feat(superset-ui-style): export ThemeProvider and useTheme 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. --- packages/superset-ui-demo/.storybook/themeDecorator.js | 3 +-- packages/superset-ui-style/README.md | 3 +-- packages/superset-ui-style/package.json | 3 ++- packages/superset-ui-style/src/index.ts | 2 ++ 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/superset-ui-demo/.storybook/themeDecorator.js b/packages/superset-ui-demo/.storybook/themeDecorator.js index 8b7cbc70b6..407fcbac07 100644 --- a/packages/superset-ui-demo/.storybook/themeDecorator.js +++ b/packages/superset-ui-demo/.storybook/themeDecorator.js @@ -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 => ( {storyFn()} diff --git a/packages/superset-ui-style/README.md b/packages/superset-ui-style/README.md index 398c67d86e..3915f877b6 100644 --- a/packages/superset-ui-style/README.md +++ b/packages/superset-ui-style/README.md @@ -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` diff --git a/packages/superset-ui-style/package.json b/packages/superset-ui-style/package.json index b482950752..197ac68364 100644 --- a/packages/superset-ui-style/package.json +++ b/packages/superset-ui-style/package.json @@ -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" } } diff --git a/packages/superset-ui-style/src/index.ts b/packages/superset-ui-style/src/index.ts index b865b37551..7fb834c9c8 100644 --- a/packages/superset-ui-style/src/index.ts +++ b/packages/superset-ui-style/src/index.ts @@ -67,3 +67,5 @@ export const supersetTheme = defaultTheme; export interface SupersetThemeProps { theme: typeof defaultTheme; } + +export { useTheme, ThemeProvider } from 'emotion-theming';