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

Tooling: Add Storybook for client/* #75167

Open
2 of 19 tasks
okmttdhr opened this issue Mar 31, 2023 · 11 comments · Fixed by #77046
Open
2 of 19 tasks

Tooling: Add Storybook for client/* #75167

okmttdhr opened this issue Mar 31, 2023 · 11 comments · Fixed by #77046
Assignees
Labels
[Type] Tooling Related to tools, scripts, automation, DevX, etc.

Comments

@okmttdhr
Copy link
Member

okmttdhr commented Mar 31, 2023

Overview

Currently, we have some Storybooks under the packages directory (e.g., tour-kit, components), but no Storybook for under the client directory.

I would suggest that we can have Storybook under the client directory. This way, we can add a "story" for every piece of UI (for components/pages/etc).

Context

Without Storybook, we need to run a local server when developing UI-related things, which is slow to debug and not easy to test all the conditions.

I would be happy to be able to develop based on Storybook at a larger granularity (e.g., per page) without limiting Storybook to so-called "components" only. https://storybook.js.org/docs/react/get-started/why-storybook#build-uis-in-isolation

There are several advantages to using Storybook for UI development.

  • Rapid development: Since components are isolated, developers can quickly prototype and iterate on their designs without waiting for a full build and refresh cycle, which can be time-consuming with a local server.
  • Organizing UI: Complex conditions can be organized and developed by component, which is helpful in finding, understanding, testing, and debugging UI patterns
  • Storybook makes component testing easy with its play function, addon, etc. https://storybook.js.org/docs/react/writing-tests/introduction

Tasks

Some tasks may be better isolated as another task.

Related Resources

@okmttdhr okmttdhr added the [Type] Tooling Related to tools, scripts, automation, DevX, etc. label Mar 31, 2023
@simison
Copy link
Member

simison commented Apr 6, 2023

Noting that this would replace https://wpcalypso.wordpress.com/devdocs/design

In addition to client, you should also include;

  • Components from @wordpress/components (rendered in Calypso context)
  • Components from @automattic/components (from packages directory in Calypso)

cc @Automattic/team-calypso who should probably own something like this.

@noahtallen
Copy link
Contributor

I think we should add storybook to the top level of the repo, and then add everything under it (including the existing storybook examples in packages, and anything we want to add from the client). Step one would probably be to get the existing packages into it

Devdocs migration is definitely promising (for having one less thing to maintain), but I could see it being tough to prioritize in the near term for our team

@tyxla
Copy link
Member

tyxla commented Apr 7, 2023

Thanks for opening the discussion up, this is a neat idea! 💯 We've already been using Storybook in many places in Calypso and Gutenberg, so I'd love to see unification in that area.

I agree that a single top-level storybook that encompasses the entire repo would be best.

As Noah said, we could start with the existing storybook instances and gradually migrate everything away from the existing devdocs. It doesn't have to be one big step, but rather many incremental ones.

This isn't something our team prioritizes (meaning, actively works on) right now, but we're happy to help with reviews, guidance, and discussion, and any other help needed.

@okmttdhr okmttdhr self-assigned this Apr 13, 2023
@danielbachhuber
Copy link
Contributor

cc @javierarce if you have any opinions about how Storybook for Calypso might work

@javierarce
Copy link

Besides what others have mentioned on this thread and from a designer perspective, it would be great to enable the Figma integration and the Accessibility addon.

And I wonder if it would make sense to use Storybook Composition to integrate other storybooks like Gutenberg or Jetpack.

@danielbachhuber
Copy link
Contributor

@okmttdhr Might be worth blogging about this on calypsop2 too?

@tyxla
Copy link
Member

tyxla commented Apr 20, 2023

I'd say migrating devdocs to use Storybook makes sense as part of the action plan listed above. Could be split into multiple steps to cover all areas.

@noahtallen noahtallen linked a pull request May 19, 2023 that will close this issue
25 tasks
@noahtallen
Copy link
Contributor

Migrating to Storybook 7 would be awesome if anyone has time for it -- it more explicitly supports React 18, which would be nice to have for #77046. I temporarily bumped the packages in #77121, but I think the changes required to support it are a little more broad to do simultaneously. We have some workarounds in our storybook configs we can probably remove now too.

I'll probably get to it eventually, but it'll take some time! :)

@noahtallen
Copy link
Contributor

Actually, it was a lot easier than I expected! I added a few options which make the initial boot faster, though it seems to load modules on demand. Storybook 7 is working pretty well in #77121, with only a couple tweaks needed.

@tyxla
Copy link
Member

tyxla commented Jun 28, 2023

@noahtallen I don't think this was closed on purpose, so reopening.

@tyxla tyxla reopened this Jun 28, 2023
@noahtallen
Copy link
Contributor

Indeed, I think GitHub must have auto-closed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Tooling Related to tools, scripts, automation, DevX, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants