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

Composite: fix Storybook docgen #64682

Merged
merged 12 commits into from
Aug 22, 2024
Merged

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Aug 21, 2024

What?

Refactor how Composite components are declared and exported to allow Storybook to generate better docs

Why?

Having Storybook automatically generate docs saves us time and ensures us that our docs are always aligned with the component's implementation.

How?

Inspired by @mirka 's #64654 (comment), the bulk of the change is:

  • moved each subcomponent to a separate file;
  • added named exports for each subcomponent.

On top of that, I've updated the contributing guidelines accordingly, assuming that this should be the recommended way of declaring / exporting sub-components.

Testing Instructions

  • Make sure the project builds;
  • Check Composite (V2) Storybook docs and examples, make sure that props (and their controls) work as expected, and that the examples also work;
  • Smoke test usage in the editor — although no runtime changes are included in this PR, using the lock/unlock API means that what would normally be a build-time error, becomes a runtime error

@ciampo ciampo force-pushed the fix/composite-v2-storybook-docgen branch from a9130e7 to 81aa986 Compare August 21, 2024 14:40
@ciampo ciampo self-assigned this Aug 21, 2024
@ciampo ciampo requested a review from a team August 21, 2024 14:53
Copy link

github-actions bot commented Aug 21, 2024

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core.
  • Labels found: [Type] Developer Documentation, [Type] Copy, [Package] Components.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@ciampo ciampo added [Type] Developer Documentation Documentation for developers [Type] Copy Issues or PRs that need copy editing assistance [Package] Components /packages/components labels Aug 21, 2024
@ciampo ciampo marked this pull request as ready for review August 21, 2024 14:53
@ciampo ciampo requested a review from ajitbohra as a code owner August 21, 2024 14:53
Copy link

github-actions bot commented Aug 21, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Ooh, really nice!

packages/components/CHANGELOG.md Outdated Show resolved Hide resolved
packages/components/CONTRIBUTING.md Outdated Show resolved Hide resolved
@ciampo ciampo force-pushed the fix/composite-v2-storybook-docgen branch from c1ee5da to 72b49dc Compare August 22, 2024 09:10
@ciampo ciampo enabled auto-merge (squash) August 22, 2024 09:10
Copy link

Flaky tests detected in 72b49dc.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10505201717
📝 Reported issues:

@ciampo ciampo merged commit 2cbba93 into trunk Aug 22, 2024
61 checks passed
@ciampo ciampo deleted the fix/composite-v2-storybook-docgen branch August 22, 2024 09:45
@github-actions github-actions bot added this to the Gutenberg 19.2 milestone Aug 22, 2024
bph pushed a commit to bph/gutenberg that referenced this pull request Aug 31, 2024
* Move subcomponents to separate files, add default export

* Remove custom Storybook args info

* Remove subcomponents folder

* Do not export `useCompositeStore` in the index.tsx file

* CHANGELOG

* Update contributing guidelines

* Remove unnecessary displayName override on top level composite

* Remove default exports

* Move CHANGELOG entry under right section

* Remove JSDoc prop types

* CHANGELOG update

* typo

---

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Copy Issues or PRs that need copy editing assistance [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants