gemini-hlsw / lucuma-react

BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Storybook with all the demos #25

Open armanbilge opened 2 years ago

armanbilge commented 2 years ago

This is a cool idea from @rpiaggio. I don't know what a storybook is actually, is there an example of this?

armanbilge commented 2 years ago

https://storybook.js.org/

hugo-vrijswijk commented 1 year ago

Having Storybook would be very useful and could replace all the demo projects. It's great for showing what variants there are of a component and what interactions it can have. I'm unsure how easy it would be to integrate scala.js components into Storybook. Each 'story' in Storybook is a .tsx/.jsx or .mdx page. The storybook CLI is pretty tightly integrated with looking for these files and parsing them, so we would either:

  1. Add .tsx/.mdx stories and render our Scala.js components in them. I have no idea how easy it is to use exported Scala.js React components in TS code
  2. Create a layer over Storybook to include Scala story files. I am uncertain if this is possible since Webpack/Vite do this with just-in-time transpilation
  3. Output *.stories.js files from Scala.js that Storybook picks up. This might be the best option, assuming Scala.js can output in the *.stories.js format, only the files we want to export. So each export would be a separate *.stories.js file, and 'shared' code is not (would just be .js files)