Doist / reactist

Open source React components made with ❤️ by Doist
http://doist.github.io/reactist
MIT License
251 stars 21 forks source link

Replace @storybook/addon-knobs with addon-controls #677

Open frankieyan opened 2 years ago

frankieyan commented 2 years ago

As addon-knobs is deprecated (ref), it should be replaced with @storybook/addon-controls.

There are only two stories (avatar, keyboard-shortcuts) left that are using knobs.

HenryKenya commented 2 years ago

Will this involve re-writing the stories using args? Sounds interesting and I'd like to give it a shot @frankieyan

frankieyan commented 2 years ago

Hi @HenryKenya - yes args and argTypes can both be used. The latter is to give more control into what kind of UI we want to show in order to change the props: https://storybook.js.org/docs/react/essentials/controls#choosing-the-control-type

The two stories are: https://github.com/Doist/reactist/blob/v14.0.0/stories/components/Avatar.stories.tsx https://github.com/Doist/reactist/blob/v14.0.0/stories/components/KeyboardShortcut.stories.tsx

I believe they already have argTypes set up, but Avatar still declares knobs as a decorator even though it is not needed, and KeyboardShortcut seems to have both declared.

Once both of these have knobs removed, we can then remove the @storybook/addon-knobs dependency.

Thank you for offering to do this :) Let me know how it goes 🙌