-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Ability to use multiple stories within a single README #171
Comments
@andyrichardson your example looks working. |
@tuchk4 here's what I'm currently seeing - its as if the second 'add' call replaces the initial story. Edit: And here is the HTML output
|
Got it. |
No worries! I believe it would require a substantial change to the API as storybook doesn't look to allow multiple stories. In order to get around this constraint, react-storybook-addon-chapters added their own |
Sounds like challenge :) Hold my bear |
I have prof of concept. @lonyele Interested your opinion about this feature # Button :star:
Application button.
\```js
import Button from 'components/Button';
\```
### Button
\```story
const Button = require('../components/Button');
<Button>Hello World</Button>
\```
### Alert button
\```story
const Button = require('../components/Button');
<Button variant="alert">Hello World</Button>
\```
|
Looks like an MDX style approach 👍 |
Hm... It took some time to come up with my solution to this problem. Just to be clear... What is desiredFrom a single README, stories with same name should be rendered on its places(In this issue's case, Possible implementation of this feature
.add('With a single Readme!', () =>
<>
<Button label={'Hello Im Button 11111'} />,
<Button label={'Hello Im Button 22222'} />,
<Button label={'Hello Im Button 33333'} />,
</>
);
) My choice of solutionI'm not sure if this is a good one or not, but I'll say it anyway... It is similar to solution 4, but with storiesOf('Multiple stories in single Readme', module)
.addParameters({
readme: {
content: TestMultipleReadme,
},
})
.add('With a single Readme!', () => {
return (
<MultipleStories
stories={[
<Button label={'Hello Im Button 11111'} />,
<Button label={'Hello Im Button 22222'} />,
<Button label={'Hello Im Button 33333'} />,
1234,
555555,
]}
/>
);
}); Below is the example of README file. We can just use
For this discussion, I made a simple implementation of my solution at my repo It is same as this repo. I made an example on branch |
Here is Proof of concept for MDX #178
Possible usage API: storiesOf('Button', module).add(
'Button variants',
mdx({
content: require('./Multiple.md'),
}),
); |
So one of the main blockers is that MDX style for both React and Vue :) Actually, I like your solution with internal components, seems it should be easier in implementation.
prettier formats code inside markdown documents very well :) I would like to ship this feature with high prio |
@tuchk4 If that's the case, sticking to MDX style is far better! |
@lonyele do you want to continue this feature? I will able to continue only after 1 month. NOTE that at proof of concept there is no good way to support knobs / info / sources / any other storybook addons . |
@tuchk4 Oh, I thought you are already working on this one because POC code doesn't look small which means you've pretty much put some effort in it. Just personally, I have to finish some works on storybook and chromium, though it will take only a few days, so I'll take a look this one right after those. It seems like I have to ask a lot of questions to you |
I am going to close this issue because now it is builtin feature at storybook 🎉🎉🎉🎉https://medium.com/storybookjs/storybook-docspage-e185bc3622bf |
Hey there. First off, thanks for the awesome package!
I'm wondering if there is/could be a way to have a single README with multiple different stories.
Example
Here I would expect the story to contain two sections Primary and Secondary with the corresponding buttons rendered.
The text was updated successfully, but these errors were encountered: