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

viewMode enhancement #8790

Closed
atanasster opened this issue Nov 11, 2019 · 2 comments
Closed

viewMode enhancement #8790

atanasster opened this issue Nov 11, 2019 · 2 comments
Labels
api: addons maintenance User-facing maintenance tasks

Comments

@atanasster
Copy link
Member

Adding a new Tab type of storybook addon generates an error:

Warning: Failed prop type: Invalid prop viewModeof valuedepssupplied toPreview, expected one of ["story","info","docs","settings"]

example usage:
https://github.com/atanasster/storybook-addon-deps/blob/master/src/register.tsx

Currently viewMode prop for addons is declared in several places:

  1. viewMode: PropTypes.oneOf(['story', 'info', 'docs', 'settings']),

  2. viewMode: PropTypes.oneOf(['story', 'info', 'docs', 'settings']),

  3. viewMode: PropTypes.oneOf(['story', 'info', 'docs', 'settings']),

  4. viewMode: PropTypes.oneOf(['story', 'info', 'docs', 'settings']),

  5. viewMode: PropTypes.oneOf(['story', 'info', 'docs', 'settings']),

This is a proposal to consolidate all those declarations into a single place to remove code duplication and to allow a generic string as a possible viewMode value so an addon can register any type of Tab.

@shilman shilman added api: addons maintenance User-facing maintenance tasks labels Nov 18, 2019
@ndelangen
Copy link
Member

The typings say it can also be any string, the propTypes should be changed to allow this.

@shilman
Copy link
Member

shilman commented Nov 28, 2019

Gadzooks!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-beta.12 containing PR #8994 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: addons maintenance User-facing maintenance tasks
Projects
None yet
Development

No branches or pull requests

3 participants