[Feature Request]: Upgrade `Primary`, `Title`, `Subtitle` and `Stories` blocks to the new v7 blocks API
#22,490 建立於 2023年5月10日
描述
Is your feature request related to a problem? Please describe
Storybook v7 introduced a new API for doc blocks that is based on an of prop and change in parameters location. See https://storybook.js.org/blog/storybook-7-docs/#doc-blocks-api-is-powerful-yet-simple
However the blocks Primary, Title and Subtitle were not fully migrated to the new API.
Describe the solution you'd like
Each block should be changed to match the general blocks API, similar to how eg. the Description block is implemented: https://github.com/storybookjs/storybook/blob/next/code/ui/blocks/src/blocks/Description.tsx
It's important that the changes are backwards compatible, and the current usage is still supported, but with a deprecation warning.
Primary
- Add support for
ofprop viauseOf- only the"meta"type is valid here - Document changes
- Add stories
- Make sure it is backwards compatible - should still work with
nameprop, or no prop at all (infers the current component)
Title
- Add support for
ofprop viauseOf- only the"meta"type is valid here - Document changes
- Add stories
- Make sure it is backwards compatible -
childrenprop should not be deprecated
Subtitle — #22552 by @joaonunomota
- Add support for
ofprop viauseOf- only the"meta"type is valid here - Default to extracting content from
parameters.docs.subtitle - Deprecate extracting content from
parameters.componentSubtitle - Document changes
- Add stories
- Make sure it is backwards compatible -
childrenprop should not be deprecated.
Stories
- Add support for
ofprop viauseOf- only the"meta"type is valid here - Default to get
titlefromparameters.docs.stories.title - Default to get
includePrimaryStoryfromparameters.docs.stories.includePrimaryStory - Document changes
- Add stories
Additional context
These changes are rather small, so they can be made in one PR or in 4 different PRs. Any new or experienced contributor is free to pick these up.
Note Anyone are free to work on these issues, you don't need to "reserve" it by asking here, just open a pull request with your work when you're done.