Giter VIP home page Giter VIP logo

Comments (3)

jeslage avatar jeslage commented on May 26, 2024

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.

inspiraller avatar inspiraller commented on May 26, 2024

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.

jeslage avatar jeslage commented on May 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.