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

✨ Added autodocs to component Storybook Stories #9547

Merged
merged 5 commits into from
Dec 18, 2023

Conversation

ahaywood
Copy link
Contributor

@ahaywood ahaywood commented Nov 17, 2023

Feature description

For the Storybook component template, I added tags: ['autodocs'] to the meta block. In context:

const meta: Meta<typeof ${pascalName}> = {
  component: ${pascalName},
  tags: ['autodocs']
}

By adding this tag, it will generate documentation for you within Storybook:

CleanShot 2023-11-17 at 12 39 12

NOTE: screenshots are from another project, but demonstrate what this tag will do

In the sidebar, you'll notice a new link called "Docs." This includes a summary of all the component, all the props that are passed in, and an overview of all the stories for this component.

CleanShot 2023-11-17 at 12 38 52

We could do this for cells, layouts, and pages, but I figured it's the most relevant and helpful on the component level.

@ahaywood ahaywood requested a review from jtoar November 17, 2023 18:42
@jtoar jtoar added the release:feature This PR introduces a new feature label Nov 17, 2023
@jtoar jtoar added this to the next-release milestone Nov 17, 2023
Copy link
Contributor

@jtoar jtoar left a comment

Choose a reason for hiding this comment

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

Updated the test project fixture to reflect this change. LGTM!

@jtoar jtoar enabled auto-merge (squash) December 7, 2023 06:33
@Tobbe
Copy link
Member

Tobbe commented Dec 7, 2023

@ahaywood Looks like you need to update the jest snapshots here. You can do that by running the tests with the -u flag

@jtoar jtoar merged commit d252440 into redwoodjs:main Dec 18, 2023
Tobbe pushed a commit that referenced this pull request Dec 21, 2023
## Feature description

For the Storybook component template, I added `tags: ['autodocs']` to
the `meta` block. In context:

```TypeScript
const meta: Meta<typeof ${pascalName}> = {
  component: ${pascalName},
  tags: ['autodocs']
}
```

By adding this tag, it will generate documentation for you within
Storybook:

![CleanShot 2023-11-17 at 12 39
12](https://github.com/redwoodjs/redwood/assets/212300/d10927d8-bb9c-4201-a614-62493b84b80a)

_NOTE: screenshots are from another project, but demonstrate what this
tag will do_

In the sidebar, you'll notice a new link called "Docs." This includes a
summary of all the component, all the props that are passed in, and an
overview of all the stories for this component.

![CleanShot 2023-11-17 at 12 38
52](https://github.com/redwoodjs/redwood/assets/212300/d063b0c8-0875-4b91-accf-7bb47d1dfc96)

We could do this for cells, layouts, and pages, but I figured it's the
most relevant and helpful on the component level.

---------

Co-authored-by: Dominic Saadi <[email protected]>
@Tobbe Tobbe modified the milestones: next-release, v6.6.0 Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants