Skip to content

Instantly share code, notes, and snippets.

@elnygren
Created April 25, 2019 17:22
Show Gist options
  • Save elnygren/5b5887ba8c39d3ae3f6182f9eee66f4c to your computer and use it in GitHub Desktop.
Save elnygren/5b5887ba8c39d3ae3f6182f9eee66f4c to your computer and use it in GitHub Desktop.
React Storybook ReasonML
open StoryBook;
let _module = [%bs.raw "module"];
storiesOf("ReasonML Example", _module)
->addDecorator(storyFn =>
<div style={ReactDOMRe.Style.make(~textAlign="center", ~marginTop="50px", ())}>
{storyFn()}
</div>
)
->add("a story with ReasonML", () =>
<div>
<p>{ReasonReact.string("Hello bs-storybook!")}</p>
<p>{ReasonReact.string("I've been styled by a storybook decorator.")}</p>
</div>
);
type section;
type webpackModule;
type chapter = unit => ReasonReact.reactElement;
type decorator = chapter => ReasonReact.reactElement;
[@bs.val] [@bs.module "@storybook/react"]
external storiesOf: (string, webpackModule) => section = "";
[@bs.send] external add: (section, string, chapter) => section = "";
[@bs.send] external addDecorator: (section, decorator) => section = "";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment