Comments (3)
Hey,
good point. This is a bug, i will work on that and will let you know when i released it. In the meantime you can try to add empty objects to the config
and overrides
keys. Does this work for you then?
const options = {
theme: themeLight,
provider: ThemeProvider,
overrides: {},
config: {}
};
from storybook-addon-theme-playground.
Thanks for reply. Unfortunately not:
Doing so I get this typescript complaint:
error:
Argument of type '{ theme: { maxTextWidth: string; pad10: string; pad20: string; fontFamily: string; fontSizeDefault: number; fontSizeL: number; primary: string; textLight: string; grey1: string; grey2: string; grey3: string; blue1: string; blue2: string; warn: string; success: string; }; provider: BaseThemeProviderComponent<...>; ov...' is not assignable to parameter of type 'ThemePlaygroundProps'.
Types of property 'config' are incompatible.
Type '{}' is missing the following properties from type 'ConfigProps': labelFormat, showCode, debounce, debounceRate
I assume its because I need to supply the strict config or overrides types, but dont' know how to access them. Perhaps even if you do solve the problem it might be good to expose those types so that they can be used like this:
import { ThemeConfigProps } from 'storybook-addon-theme-playground';
// other stuff ...
const options: ThemeConfigProps<typeof themeLight> = {
theme: themeLight,
provider: ThemeProvider,
overrides: {},
config: {}
};
or if you prefer via extending interface
interface ThemeOptions extends ThemeConfigProps {
theme: typeof themeLight;
};
const options: ThemeOptions = {
theme: themeLight,
provider: ThemeProvider,
overrides: {},
config: {}
};
from storybook-addon-theme-playground.
I released a new version. You can update to version 1.3.4
. The package exports the interface ThemePlaygroundProps
and the properties config
and overrides
are optional now.
import { withThemePlayground, ThemePlaygroundProps } from 'storybook-addon-theme-playground';
interface ThemeOptions extends ThemePlaygroundProps {
theme: typeof themeLight;
};
const options: ThemeOptions = {
theme: themeLight,
provider: ThemeProvider
};
export const decorators = [withThemePlayground(options)];
If you have still issues with the implementation, just let me know!
from storybook-addon-theme-playground.
Related Issues (9)
- Theme doesn't persist when changing story
- Configured theme does not persist between changing story HOT 4
- Theme object throws error HOT 4
- Storyshots Invalid hook call when using addon-theme-playground HOT 4
- Panel not loading HOT 3
- Get current theme in decorator function HOT 5
- React 18 Update HOT 13
- Fails to import `lodash` with Yarn 2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook-addon-theme-playground.