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

[Docs][React] Not rendering code from imported file #13719

Closed
jgodi opened this issue Jan 25, 2021 · 1 comment
Closed

[Docs][React] Not rendering code from imported file #13719

jgodi opened this issue Jan 25, 2021 · 1 comment

Comments

@jgodi
Copy link

jgodi commented Jan 25, 2021

Describe the bug
I have a storybook where I want to showcase some of the logic that our components can do (i.e. onClick, etc). To do that I have created an external React component that I import into my stories.mdx file. It only shows the <ReactComponent /> as the story source.

Code: https://github.com/jgodi/storybook-react-test/blob/master/src/stories/Button.stories.mdx

Is where a way to get the actual code within the source? We only publish the doc mode when publishing out our Storybook and typically write our stories just like this.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://jgodi.github.io/storybook-react-test/?path=/docs/button--primary#click-handler
  2. Click on "Show Code" for the "Click Handler" story
  3. See the code just renders <ButtonStoryTest />

Expected behavior
The source code of the <ButtonStoryTest /> to render.

System

  System:
    OS: macOS 11.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm
  Browsers:
    Chrome: 88.0.4324.96
    Safari: 14.0.2
  npmPackages:
    @storybook/addon-actions: ^6.1.15 => 6.1.15
    @storybook/addon-docs: ^6.1.15 => 6.1.15
    @storybook/addon-essentials: ^6.1.15 => 6.1.15
    @storybook/addon-links: ^6.1.15 => 6.1.15
    @storybook/addon-storysource: ^6.1.15 => 6.1.15
    @storybook/node-logger: ^6.1.15 => 6.1.15
    @storybook/preset-create-react-app: ^3.1.5 => 3.1.5
    @storybook/react: ^6.1.15 => 6.1.15
    @storybook/storybook-deployer: ^2.8.7 => 2.8.7
@jgodi
Copy link
Author

jgodi commented Jan 31, 2021

Closing due to I was using it improperly

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

2 participants