-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: StoryDescription is not shown for first story #8093
Comments
Hey, absolutely new to contributing to open source community. Can i give this a shot? Have some experience setting up and creating storybooks from scratch. Would be a good challenge that i would like to take on. |
@patelvp would be awesome! Lmk if you have q’s |
Was able to find the bug.
The first story is printed by the |
That was a design decision, tho now I'm not sure it was the correct one. @domyen WDYT? |
@shilman Might've messed up creating a PR. New to forking and creating a PR. Not sure why there are so many commits on the PR. |
@patelvp branch from |
@shilman Can you take a look at the PR? |
I don't know... every time I write stories I stumble over this issue. I think it would be nice if Storybook would not emphasize the first story by default. It should be treated like the other stories and there should be a way to write a more general introduction/description unrelated to a specific story, if needed. But just my opinion. It's probably too late to get this into v6? (Update: Workaround for v6-rc: import {
Title,
Subtitle,
Description,
Primary,
Props,
Stories,
PRIMARY_STORY,
} from '@storybook/addon-docs/blocks';
import React from 'react';
export const parameters = {
docs: {
page: () => (
<>
<Title />
<Subtitle />
<Description />
- <Primary />
<Props story={PRIMARY_STORY} />
- <Stories />
+ <Stories includePrimary />
</>
),
},
}; But I still think it is an UX gotcha. 🤔) |
cc @domyen |
Apologies for the late reply everyone 🙏. There seem to be two issues here:
The idea of "Primary" stories There are a few things we can do here:
I don't think it makes sense to eliminate the primary story concept because a use case we'd like to support in 6.0 is live adjusting that story via the ArgsTable. I think this behavior with make the primary distinction make a bit more sense. |
@domyen we can make it work. I'm going to add this to my todo list and i'll circle back to it shortly. Sounds good? |
I can work on
|
I like this proposal @domyen. i think we can squeeze it in for 6.0 if there's a good PR in the next day or two. @patelvp people can override the primary story behavior using @donaldpipowitch 's workaround above #8093 (comment) |
@shilman @domyen - There are a couple of thoughts I had regarding this:
If the encouraged pattern is to have a Thank you! |
I too have been looking for hours for a way to ignore the "primary" story and show all the stories in the docs-page right below the (automatically generated) "Stories" title. Almost none of my stories makes sense to have a "primary" story. I want the docs-page to document all the stories, as equal, one after the other |
Actually this was the solution: export default {
title: 'CSS/Fonts',
parameters: {
docs: {
page: () => (
<>
<Subtitle />
<Description markdown={docs}/>
<br/>
<Stories includePrimary={true} title='' /> // hide default "stories" title - senseless to show.
</>
),
},
},
} So basically not including The documentation of Storybook is not much helpful and poorly orders for my needs so I find myself constantly reading the source code of different components, find which props they accept and hack it through. |
Is there a way to make these |
@matthew-dean — Yes, by applying the parameter globally: https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters. In that latest snippet, though, the |
Any update on this? |
Not sure why the |
Totally agree with @antoniogamizbadger, I think that could be good to have a general parameter flag to override that behavior rather than having to redefine the entire page config. |
As of Storybook 7, the Stories block now renders the primary (first) story by default (and you can opt-out with Because of that change and because the Stories block renders all story's descriptions, this issue will now be closed. |
Describe the bug
For the first story after
storiesOf
, anystoryDescription
is not shown.To Reproduce
Steps to reproduce the behavior:
button.stories.js
Expected behavior
The
storyDescription
should show, just like it does for any other story.Code snippets
System:
Please paste the results of
npx -p @storybook/cli@next sb info
here.Environment Info:
System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Browsers:
Chrome: 76.0.3809.132
Safari: 12.1.2
npmPackages:
@storybook/addon-a11y: ^5.2.0 => 5.2.0
@storybook/addon-docs: ^5.2.0 => 5.2.0
@storybook/addon-storysource: ^5.2.0 => 5.2.0
@storybook/addon-viewport: ^5.2.0 => 5.2.0
@storybook/react: ^5.2.0 => 5.2.0
The text was updated successfully, but these errors were encountered: