react-theming / storybook-addon-material-ui

Addon for storybook wich wrap material-ui components into MuiThemeProvider. :page_with_curl: This helps and simplifies development of material-ui based components.

Home Page:https://github.com/sm-react/storybook-addon-material-ui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for 4.x version

pragmaticivan opened this issue · comments

It seems to currently work with v3, but that's already outdated.

Are there any plans on updating it for 4.x or is it currently not in the timeframe to do this? Are there areas to help with that?

Hi I'm planning to start solving this in my nearest free time. I think not sooner then next week. You can help with describing what exactly should be changed to support v4. Or PR's are always welcome as well! :)

Hi, first of all thank you for your nice Plugin.

It is also not working correctly for Storybook v 5.x. There is no Theme Editor and it is not possible to download a set of theme. The application does not work like your demo for v. 3.x offers.
Bildschirmfoto 2019-10-30 um 11 52 53

It is also not working correctly for Storybook v 5.x. There is no Theme Editor and it is not possible to download a set of theme. The application does not work like your demo for v. 3.x offers.

I think is the main issue here, probably some APIs for storybook have changed from 4 to 5 i suppose. Unfortunately i am not that versed yet in the structure of both projects, so it will be difficult for me to find the points to help. If anybody know on which parts tweaks have to be made, i am willing to help out here.

commented

Hi I'm planning to start solving this in my nearest free time. I think not sooner then next week. You can help with describing what exactly should be changed to support v4. Or PR's are always welcome as well! :)

Not directly related with supporting Storybook 4.x, but in case is relevant I think it would be a good idea to support the new CSF config

I've been able to make this addon work with Storybook 5.x with the CSF config, maybe is just a matter of documentation.

So instead of this:

storiesOf('Material-UI', module)
// Add the `muiTheme` decorator to provide material-ui support to your stories.
// If you do not specify any arguments it starts with two default themes
// You can also configure `muiTheme` as a global decorator.
    .addDecorator(muiTheme())
    .add('Card Example Controlled', () => (
            <CardExampleControlled />
        ))
    .add('Raised Button Example Simple', () => (
            <RaisedButtonExampleSimple />
        ))
    .add('Date Picker Example Simple', () => (
            <DatePickerExampleSimple />
        ));

It can be configured now like this using CSF:

export default { title: "Material-UI" };

export const CardExampleControlled = () => (
  <CardExampleControlled />
);

export const RaisedButtonExampleSimple = () => (
  <RaisedButtonExampleSimple />
);

export const DatePickerExampleSimple = () => (
  <DatePickerExampleSimple />
);

And here an example of config.js under .storybook folder updated following the current documentation example:

import { muiTheme } from "storybook-addon-material-ui";
import { configure } from "@storybook/react";
import { addDecorator } from "@storybook/react";
import theme from "../src/MuiTheme";

addDecorator(muiTheme(theme));

configure(require.context("../src/", true, /\.stories\.tsx$/), module);

Hi @usulpro do you have any news for complete functionality for Storybook 5?

best Peter

Tested the current version of addon (alpha 21) with latest Material-UI and Storybook. see here https://github.com/react-theming/create-material-ui-app

Let me know if there are any compatibility issues

Related to other functionality: It's in the road map. Mostly after switching to https://github.com/react-theming/storybook-addon-theming

Hi @usulpro,

Thank you and happy new year. I have tested your dependency updates. The addon itself is still working like before. Do you think that the complete functionality from your Demo for Storybook 3, specially "download theme" and "theme editor" will be integrated in Roadmap project https://github.com/react-theming/storybook-addon-theming? When is it possible to use it?

best Peter

Hey @scurrilus-funke,

Thanks and Happy new year to you too!

I think "download theme" could be easily restored, we don't need addon-theming for that so I'll try to check it this weekend

With theme editor another situation. I'd like to finish addon-theming first and after that it would be easy to support only material-ui features here and involve contributors to this addon. I can do it only in my spare time so it's hard to name any specific ranges. In general, the base that handles everything related to communication via a channel is ready and already used for other addons so the only what is left is to implement themes specific features

It doesn't appear that https://github.com/react-theming/create-material-ui-app when running locally either. I see the panel with the themes, however, your stories don't actually change themes. Please see my latest issue here