Skip to content
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

Add Doc Blocks overview & API reference #21113

Merged
merged 11 commits into from
Feb 22, 2023
Merged

Add Doc Blocks overview & API reference #21113

merged 11 commits into from
Feb 22, 2023

Conversation

kylegach
Copy link
Contributor

@kylegach kylegach commented Feb 16, 2023

What I did

  • Add Doc Blocks overview & API reference pages for each block
  • Remove Doc Blocks guides
  • Update docs/api/argtypes to include information that was in docs/writing-docs/doc-block-argstable
  • Update TOC
    • Change Write docs > Doc blocks from a menu to a page
    • Add API > @storybook/blocks menu
Before After
Screenshot of current TOC Screenshot of proposed TOC

Example page

Screenshot of ArgTypes doc block API reference

WIP

  • Add/update screenshots for all doc blocks

How to test

  1. In frontpage, check out the docs-content-style-tweaks branch (see related PR)
    • The content won't look right otherwise
  2. Extract the docs for this branch: yarn extract-monorepo-docs doc-blocks-docs
  3. Start the site: GATSBY_SKIP_ADDON_PAGES=true yarn start
  4. Navigate to the updated/new pages:

What to check for:

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic job @kylegach ! I have a few suggestions all over the place.

docs/api/argtypes.md Outdated Show resolved Hide resolved
docs/api/doc-block-canvas.md Outdated Show resolved Hide resolved
docs/api/doc-block-canvas.md Show resolved Hide resolved
docs/api/doc-block-canvas.md Outdated Show resolved Hide resolved
docs/api/doc-block-canvas.md Outdated Show resolved Hide resolved
docs/api/doc-block-description.md Show resolved Hide resolved
docs/api/doc-block-argtypes.md Outdated Show resolved Hide resolved
docs/api/doc-block-markdown.md Outdated Show resolved Hide resolved
docs/api/doc-block-markdown.md Outdated Show resolved Hide resolved
docs/api/doc-block-story.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jonniebigodes jonniebigodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job overall 👏 . I left some items that require attention, including snippets we should consider porting over.

docs/api/doc-block-argtypes.md Outdated Show resolved Hide resolved
docs/api/doc-block-argtypes.md Outdated Show resolved Hide resolved
docs/api/doc-block-canvas.md Outdated Show resolved Hide resolved
docs/api/doc-block-colorpalette.md Outdated Show resolved Hide resolved
docs/api/doc-block-controls.md Outdated Show resolved Hide resolved
docs/api/doc-block-story.md Show resolved Hide resolved
docs/api/doc-block-unstyled.md Show resolved Hide resolved
docs/api/doc-block-useof.md Outdated Show resolved Hide resolved
docs/api/doc-block-useof.md Outdated Show resolved Hide resolved
docs/api/doc-block-useof.md Outdated Show resolved Hide resolved

Each block has a dedicated API reference page, detailing usage, available options, and technical details.

If a doc block accepts parameters, it is marked with **(P)**.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really not sure about this idea. Very welcome to suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's needed? I would think it's self-explanatory that some of them reacts to parameters.docs.X, some don't.

Eg. ColorPalette doesn't because it doesn't reference any stories/components, so there's no where to pull parameters from. I don't think a user would try that.

But then I also see that Description don't have a (P), which definitely reads from parameters, so maybe I'm misunderstanding the idea here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description is an odd duck. The content is provided via parameters, but the block isn't configured that way. 🤷‍♂️

The thought behind marking the blocks was an attempt at helping people understand (before clicking through to the API reference) which blocks can be configured. But I have another idea...

kylegach and others added 10 commits February 21, 2023 22:38
- Remove Doc Blocks guides
- Update `docs/api/argtypes` to include information that was in `docs/writing-docs/doc-block-argstable`
- Update TOC
    - Change `Write docs > Doc blocks` from a menu to a page
    - Add `API > @storybook/blocks menu`
Co-authored-by: Jeppe Reinhold <jeppe@chromatic.com>
Co-authored-by: Jeppe Reinhold <jeppe@chromatic.com>
- Simplify heading hierarchy
- Make it more explicit that some block's prop's default values are derived from parameters
- Consistently include space after filename comment
- Include `<Meta />` in snippets for blocks that are used in attached docs
- Grammatical improvements
- Update ArgTypes and Controls parameter/prop examples
@kylegach
Copy link
Contributor Author

This is a docs-only change, so I'm merging despite CI failures.

@kylegach kylegach merged commit d7e074f into next Feb 22, 2023
@kylegach kylegach deleted the doc-blocks-docs branch February 22, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants