-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Blocks: new Description API, introduce useOf #20563
Conversation
… github.com:storybookjs/storybook into block-description-improvements
…scription-improvements
@tmeasday note that the stories that rely on the comment on meta are actually wrong, because we aren't actually extracting meta comments right now. so they currently fall back to the component's description. But I want to do that in a follow up PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. A couple final details to iron out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one very minor naming query
Co-authored-by: Tom Coleman <tom@chromatic.com>
#19964
This PR changes the Description block to work fully with the
of
API. It also introduces theuseOf
hook which is also meant as a public API.Description
block now accepts anof
prop that is a reference to either a meta (default) export, a story export, or the whole CSF file (ie.import * as SomeStories from 'some.stories.tsx
).Description
is rendered without anof
prop, it will look for a description on meta/component in attached mode and throw in unattached mode.useOf
returns a combination of the result ofDocsContext.resolveModuleExport
andDocsContext.store.projectAnnotations
.The docs for this are in progress, but if anyone wants to try this out immediately, the drafts can be read on this Notion page.
(reminding myself to remove this link when the docs are published, as this link will get stale)
Stories are a bit messy because we need different CSF files for testing different meta description setups, but I've tried to group it as best as possible.
To do