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

Blocks: Support subcomponents in ArgTypes and Controls, remove ArgsTable block #25614

Merged
merged 13 commits into from
Jan 18, 2024

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Jan 16, 2024

Closes #20782

What I did

#20782 (comment)

  • Ported over subcomponents support to the ArgTypes and Controls doc blocks (this means that autodocs now supports subcomponents natively
  • Removed the ArgsTable doc block, as this was the last blocker to remove it
  • Removed deprecation warnings about subcomponents

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  1. Run a sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Add a subcomponent to Header.stories.ts:
...
import { Header } from './Header';
import { Button } from './Button';

const meta = {
  title: 'Example/Header',
  component: Header,
  subcomponents: { Button },
  // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
  tags: ['autodocs'],
  parameters: {
    // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
    layout: 'fullscreen',
  },
} satisfies Meta<typeof Header>;
...
  1. Visit autodocs for Header stories and see the "Button" tab in the controls panel. http://localhost:6006/?path=/docs/example-header--docs

  2. Add a new MDX file with the following content:

import * as HeaderStories from './Header.stories';
import { ArgTypes, Controls, Canvas } from '@storybook/blocks';

# ArgTypes

<ArgTypes of={HeaderStories} />

# Controls

<Canvas of={HeaderStories.LoggedIn} />
<Controls of={HeaderStories.LoggedIn} />
  1. Open it in Storybook and see the two tables now also have the Button tab.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@JReinhold JReinhold marked this pull request as ready for review January 16, 2024 13:59
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 didn't review all the stories -- will leave that to @kasperpeulen . I wonder if you want to mark them as { chromatic: { disable: true } } just to save some resources.

MIGRATION.md Outdated Show resolved Hide resolved
MIGRATION.md Outdated Show resolved Hide resolved
@JReinhold JReinhold merged commit b5491cd into next Jan 18, 2024
53 of 58 checks passed
@JReinhold JReinhold deleted the jeppe/20782-subcomponents branch January 18, 2024 12:51
@github-actions github-actions bot mentioned this pull request Jan 18, 2024
18 tasks
valentinpalkovic added a commit that referenced this pull request Jan 18, 2024
…ponents"

This reverts commit b5491cd, reversing
changes made to 81db91d.
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.

[Feature Request]: Subcomponents support
3 participants