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

Addon-docs: Add docsContainer parameter #7813

Closed
6 tasks done
shilman opened this issue Aug 20, 2019 · 1 comment
Closed
6 tasks done

Addon-docs: Add docsContainer parameter #7813

shilman opened this issue Aug 20, 2019 · 1 comment

Comments

@shilman
Copy link
Member

shilman commented Aug 20, 2019

Problem

SB Docs has a DocsContainer component that adds a bunch of context providers including: DocsContext, Theme, MDX, as well as some global page formatting. Most Doc Blocks need this context to function.

We can't add this wrapper in @storybook/core because it adds a bad dependency. Therefore it's automatically inserted by the MDX compiler and also included inside the DocsPage component.

However, the current structure is limited in the following ways:

  1. Duplicate code between compiler & DocsPage
  2. No easy way to use Doc Blocks in arbitrary docs override e.g. CSF Stories with MDX Docs recipe not working #7810 -- user would also need to add this code
  3. Inflexible: there's no easy way to override the wrapper if needed

Solution

  • Refactor DocsContainer into a docsContainer parameter (dependency injection)
  • Have presets set this parameter
  • Update manual config docs
  • Update tests
  • Update DocsPage & MDX compiler
  • Clean up API in the process (content prop => children)
@shilman
Copy link
Member Author

shilman commented Aug 20, 2019

Egads!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.0-beta.37 containing PR #7814 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.

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