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

Tabs: Auto-generate README #68209

Open
wants to merge 11 commits into
base: trunk
Choose a base branch
from
Open

Tabs: Auto-generate README #68209

wants to merge 11 commits into from

Conversation

mirka
Copy link
Member

@mirka mirka commented Dec 20, 2024

Stacked on #68208

What?

Convert the Tabs README to an auto-generated one.

Supplementary information that was in the existing README is moved to other appropriate locations (JSDocs, Storybook "Best Practices" page).

Why?

To decrease maintenance cost and consolidate the canonical docs for our audience.

Testing Instructions

  • In your IDE, check imports of Tabs.Tab for example, and see that the JSDoc includes the subcomponent description.
  • npm run docs:components to regenerate READMEs.
  • See Storybook docs for Tabs.

@mirka mirka added [Type] Developer Documentation Documentation for developers [Package] Components /packages/components labels Dec 20, 2024
@mirka mirka self-assigned this Dec 20, 2024
@mirka mirka requested a review from ajitbohra as a code owner December 20, 2024 17:43
Copy link

github-actions bot commented Dec 20, 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: mirka <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>

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

packages/components/src/tabs/tab.tsx Outdated Show resolved Hide resolved
* for more info.
*
* @default true
*
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabpanel/
Copy link
Member Author

Choose a reason for hiding this comment

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

We should avoid @see tags as they are suppressed in Storybook props tables, and don't make sense when displayed unformatted in the auto-generated README.

packages/components/src/tabs/README.md Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Dec 20, 2024

Flaky tests detected in 20fc6d1.
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/12506584582
📝 Reported issues:

Base automatically changed from autogen-readme-spacing to trunk December 20, 2024 22:54
@mirka mirka requested review from ntwb and nerrad as code owners December 20, 2024 22:54
bin/api-docs/gen-components-docs/markdown/index.mjs Outdated Show resolved Hide resolved
import { Tabs } from '@wordpress/components';

const onSelect = ( tabName ) => {
console.log( 'Selecting tab', tabName );
Copy link
Member

Choose a reason for hiding this comment

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

Are we intentionally using 2 spaces instead of a single tab here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Me personally, yes. I find it very hard to read those tabbed code snippets in places where the tab width is fixed at 8 spaces 😅

Copy link
Member

Choose a reason for hiding this comment

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

I find it quite the opposite FWIW. I'm used to 4-space tabs and what I'm seeing here feels so packed 😱

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok my brain exaggerated, everywhere I perceived as tab width 8 ("super wide!") was just 4 😂

  • Block Editor Handbook: 4
  • Storybook: 4
  • GitHub Markdown Preview: 4

The only objective reasoning I can think of to prefer 2 spaces is because the automatic code snippets in Storybook use that (and is not configurable).

I'm fine with unifying back to tabs. That is what our codebase mandates, after all 🤷

Copy link
Member

Choose a reason for hiding this comment

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

😅 Thanks, yes, unifying back to tabs makes sense.

packages/components/src/tabs/index.tsx Outdated Show resolved Hide resolved
packages/components/src/tabs/README.md Outdated Show resolved Hide resolved
packages/components/src/tabs/README.md Outdated Show resolved Hide resolved
@@ -1,254 +1,216 @@
# Tabs
Copy link
Contributor

Choose a reason for hiding this comment

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

Repeated from https://github.com/WordPress/gutenberg/pull/68249/files#r1895926109Tabs is currently a private API, but there's no mention of this in the README. Should we add a way to flag that in the generated README?

Copy link
Member Author

Choose a reason for hiding this comment

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

Proposed in #68317

mirka and others added 7 commits December 24, 2024 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants