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-info] Need another way to pull description from docgen info #4373

Closed
joefiorini opened this issue Oct 11, 2018 · 5 comments
Closed

[addon-info] Need another way to pull description from docgen info #4373

joefiorini opened this issue Oct 11, 2018 · 5 comments

Comments

@joefiorini
Copy link

Bug or support request summary

I created components with docgen description comments like:

/** This is the description */
class Button extends React.Component {
  // ...
}

And then I create a story named "Secondary Button", when I click "Show Info" I expect to see "This is the description" from my component somewhere on the page, but I do not.

If I rename the story to just "Button" then I do see "This is the description".

The problem seems to be in the _getComponentDescription() function, which is comparing the displayName of the component to context.story, which appears to be the story name.

It seems like having a secondary condition here might be useful. One approach might be adding another option to the parameters for info like:

{
  info: {
    descriptionClass: Button
  }
}

Another option would be to allow passing the class where we can currently pass a string description (ie. text), ie:

{
  info: {
    text: Button
  }
}

As a bonus, with multiple components, this would allow us to tell which component to get the description from.

Thoughts?

Steps to reproduce

Create a story for a component that has a docgen description comment, where the story name is not the same as the component's displayName property and you will see this issue.

Please specify which version of Storybook and optionally any affected addons that you're running

❯ yarn list --pattern @storybook
yarn list v1.10.1
├─ @storybook/[email protected]
├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  ├─ @storybook/[email protected]
│  └─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
│  └─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
├─ @storybook/[email protected]
└─ @storybook/[email protected]
@ndelangen
Copy link
Member

Marking this as a todo for #4341

@ndelangen ndelangen mentioned this issue Oct 13, 2018
16 tasks
@stale
Copy link

stale bot commented Nov 3, 2018

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Nov 3, 2018
@brandonce
Copy link

This looks similar to #4643

@stale
Copy link

stale bot commented Dec 5, 2018

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale
Copy link

stale bot commented Jan 5, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Jan 5, 2019
@shilman shilman added this to the v5.1.0 milestone Mar 22, 2019
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

5 participants