Created
April 25, 2019 17:22
-
-
Save elnygren/5b5887ba8c39d3ae3f6182f9eee66f4c to your computer and use it in GitHub Desktop.
React Storybook ReasonML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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