rescript-storybook icon indicating copy to clipboard operation
rescript-storybook copied to clipboard

Any plans to add support for Controls?

Open BlueHotDog opened this issue 4 years ago • 1 comments

Hey, was wondering if you've any thoughts on adding support for Controls(https://github.com/storybookjs/storybook/blob/next/addons/controls/README.md#writing-stories)

BlueHotDog avatar Feb 25 '21 20:02 BlueHotDog

Hey @BlueHotDog

Their API isn't something doable in Reason that translates one-to-one, the CSF module relies hardly on JavaScript type weakness which is almost impossible to bind in Reason:

  • Exporting a component as a value it's not doable in Reason.
  • Adding a field property to a function (treat functions as objects).
  • Treating the props API as optional.

We might get far from doing some bridge code: instead of doing straight bindings, we could make a functor out of CSF define something alike.

module type CSF = {
  type props;
  let make: props => React.element;
};

I only explore this path theoretically, which makes things more abstract. If there's a lot of need for Controls I might spend some time trying.

Let me know if make sense, Thanks for opening an issue!

davesnx avatar Feb 25 '21 21:02 davesnx