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

Autodocs: Hide Stories block when only primary story exists #21178

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Feb 21, 2023

Closes #20969

What I did

This PR adds a special case to the default DocsPage block for single story autodocs:

  • Hide the "Stories" section below, to not show the primary story twice
  • Move the primary story's description from the now hidden stories section to between the component description and the canvas.

How to test

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"]

@JReinhold JReinhold self-assigned this Feb 21, 2023
@JReinhold JReinhold requested a review from shilman February 21, 2023 11:56
@shilman shilman changed the title make Stories block hide itself when only one story exists Autodocs: Hide Stories block when only one story exists Feb 21, 2023
@shilman shilman changed the title Autodocs: Hide Stories block when only one story exists Autodocs: Hide Stories block when only primary story exists Feb 21, 2023
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM!

@MichaelArestad
Copy link
Contributor

@JReinhold Is there somewhere I can see an example of this in one of the test Storybooks?

@JReinhold
Copy link
Contributor Author

JReinhold commented Feb 21, 2023

After discussing this with @MichaelArestad we decided that the primary story's description should be featured below the component description in the case of single stories. See screenshots below, and Chromatic UI Review: https://www.chromatic.com/pullrequest?appId=635781f3500dd2c49e189caf&number=21178&view=changes

The only downside here is the fact that we now loose the narrative that "The DocsPage is super simple, you can copy it from here" because now it contains actual logic: https://github.com/storybookjs/storybook/pull/21178/files#diff-c940951c2adc4415d2b5dd98d12260a366f44fcd5ae7d4a3e92744ef780df9e8R11-R27
Any thoughts about that @shilman?

Single story

image

Multiple stories

image

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

I'm ok with this too, tho it lacks the simplicity of before. Please update the PR description before merging 🙏

@JReinhold JReinhold merged commit d05fde6 into next Feb 23, 2023
@JReinhold JReinhold deleted the 20969-bug-autodocs-pages-that-only-contain-a-single-story-show-the-same-story-twice branch February 23, 2023 09:42
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.

[Bug]: autodocs pages that only contain a single story show the same story twice
4 participants