Storybook: addon-info works poorly with nesting & titles

Created on 1 Aug 2019  路  10Comments  路  Source: storybookjs/storybook

Describe the bug
If you use a title or a nested folder in your story name, addon-info shows an ugly title and does not show the documentation for the component

To Reproduce
Create a story with metadata in the title such as Components/ExampleComponent and then look at the story info pane

Expected behavior
The title should not include any metadata and the class documentation should be visible

Screenshots
Screenshot 2019-08-01 at 14 06 47
Screenshot 2019-08-01 at 14 06 56
Screenshot 2019-08-01 at 14 07 07

Code snippets
_example-component.jsx_

import PropTypes from "prop-types";
import React from "react";

/**
 * This is an example component that displays words
 */
export function ExampleComponent({ words }) {
    return <p>{words}</p>;
}

ExampleComponent.propTypes = {
    /** What to show in the component */
    words: PropTypes.string,
};

ExampleComponent.defaultProps = {
    words: "Hello, World!",
};

_example-component.stories.js_

import { storiesOf } from "@storybook/react";
import React from "react";
import { ExampleComponent } from "./example-component";


let storyA = storiesOf("Components|ExampleComponent", module);
storyA.add("Example #1", () => <ExampleComponent />);

let storyB = storiesOf("Components/ExampleComponent", module);
storyB.add("Example #2", () => <ExampleComponent />);

let storyC = storiesOf("ExampleComponent", module);
storyC.add("Example #3", () => <ExampleComponent />);

System:

  System:
    OS: macOS 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 75.0.3770.142
    Safari: 12.1.2

(ps: I also have Firefox 68.0.1 installed)

Additional context
Story._getComponentDescription checks for a fulltext match against the story title, rather than a partial.

info bug inactive

All 10 comments

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!

I guess I can have a poke at trying to fix this?

@Lexicality absolutely! would welcome a PR for this 馃檹

I've got a patch that should work but I'm having considerable trouble getting a development environment working for this project

FYI addon-info聽is being superceded by聽addon-docs, which fixes a bunch of bugs and is easier to maintain. It鈥檚 reached release candidate (RC) status and will be properly released soon. Please give it a try!聽https://medium.com/storybookjs/storybook-docspage-e185bc3622bf

I'm aware, but unfortunately my team's pretty busy right now and I'd vastly prefer to just fix what we're currently using with a patch version update rather than spend any extra time changing things to a new system. 馃檪

@Lexicality completely understood. happy to merge the PR and patch it back into 5.1.x once it's ready!

Just saw your dev environment comment. Did you get it working? Happy to help you out on Discord if it's useful: https://discord.gg/UUt2PJb

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!

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tirli picture tirli  路  3Comments

wahengchang picture wahengchang  路  3Comments

rpersaud picture rpersaud  路  3Comments

zvictor picture zvictor  路  3Comments

tomitrescak picture tomitrescak  路  3Comments