Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please provide support for addDecorator in main.js #18026

Open
maxbogus opened this issue Apr 22, 2022 · 0 comments
Open

Please provide support for addDecorator in main.js #18026

maxbogus opened this issue Apr 22, 2022 · 0 comments

Comments

@maxbogus
Copy link

maxbogus commented Apr 22, 2022

Is your feature request related to a problem? Please describe
In your next version you are planning to get rid off configure and addDecorator. This would ruin our storybook components support.
In our project we are using addDecorator to attach translations and styles to stories.

wrapper.js example:

const Wrapper = injectSheet(globalStyle)(
  ({ children }: { children: JSX.Element }) => children
);
const StoryWrapper = (story: () => JSX.Element) => (
  <LocaleProvider>
    {(locale: string) => (
      <LocalizationContainer key={locale} locale={locale}>
        <ThemeProvider theme={extendedIplUiTheme}>
          <FontsProvider>
            <Wrapper>{story()}</Wrapper>
          </FontsProvider>
        </ThemeProvider>
      </LocalizationContainer>
    )}
  </LocaleProvider>
);

StoryWrapper.defaultName = 'Story Wrapper';
export default StoryWrapper;

config.js example:
import { addDecorator, configure } from '@storybook/react'; addDecorator(wrapper);

Describe the solution you'd like
You could add new add-on type for such wrappers. For example: 'my-add-on/wrapper'.

Alternative solution would be
Don't remove addDecorator and config.js support in the next release.

Are you able to assist to bring the feature to reality?
Probably, I could try to assist, but I need some guidance..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant