hackoregon / civic

The frontend monorepo for the CIVIC platform.
http://civicplatform.org
MIT License
60 stars 26 forks source link

Upgrade Storybook, convert stories to CSF format, implement Chromatic #1219

Closed jaronheard closed 3 years ago

jaronheard commented 3 years ago

This PR upgrades Storybook 5 -> 6, and goes through the process of converting the ui-core package to use the new Component Story Format. Besides having a great acronym, the Component Story Format enables really nice automatically generated docs, can link up with more automated testing and tools, and is much cleaner than the previous storiesOf notation.

It also sets up a configuration for Chromatic, which is an advanced deploy preview and visual testing tool for Storybook. My plan would be to set it up on CI so that we get a preview on each PR.

Feedback, please!

I'd like feedback in a few areas.

✨Check it out!✨

Notes

Screenshots

Docs

image image

The new controls view

Knobs have been replaced with controls. The type of control is inferred from the PropTypes, and the description is pulled from JSDoc comments on the PropTypes. It's pretty slick.

image
jaronheard commented 3 years ago

I've added stories for the ui-docs and ui-charts packages. One really exciting opportunity with the new Storybook MDX format is being able to mix stories and documentation. I translated the data visualization guidelines that the Data Visualization platform team from the 2019 Hack Oregon season put together into mdx format with embedded interactive stories. I can also imagine a tool that allows users to view their data as many different types of charts -- it would actually be very straightforward to put together!

jaronheard commented 3 years ago

Phew! I think that this PR is ready for final review.

Since the tests of CSF and Chromatic were successful, this PR continues into implementation

The one exception is that ui-maps hasn't been converted -- I'd like to make that a follow-up issue. It also disables automatic publishing of the old Storybook. Once ui-maps is converted, we can update all of the links to hackoregon.github.io to the new Storybook.

I'm interested in some fresh eyes, and comparing the usability of this updated approach to our old approach