@@ -4,9 +4,9 @@ BuckleScript bindings for **[Storybook](https://storybook.js.org/)**.
44
55The goal of this project is to provide bindings for the main Storybook API, as well as the official add-ons. Currently it supports:
66
7- * [ actions] ( https://github.com/storybooks/storybook/tree/master/addons/actions )
8- * [ knobs] ( https://github.com/storybooks/storybook/tree/master/addons/knobs )
9- * [ addons API] ( https://storybook.js.org/addons/writing-addons/ )
7+ - [ actions] ( https://github.com/storybooks/storybook/tree/master/addons/actions )
8+ - [ knobs] ( https://github.com/storybooks/storybook/tree/master/addons/knobs )
9+ - [ addons API] ( https://storybook.js.org/addons/writing-addons/ )
1010
1111## Getting Started
1212
@@ -26,9 +26,9 @@ In your `/.storybook/config.js`, import your stories from wherever your compiled
2626For example, if you're writing your stories inside a ` __stories__ ` directory, and ` bsb ` is configured for a standard build, you might do something like:
2727
2828``` javascript
29- const req = require .context (' ../lib/js' , true , / \_ _stories__\/ . * . js$ / );
29+ const req = require .context (" ../lib/js" , true , / \_ _stories__\/ . * . js$ / );
3030configure (() => {
31- req .keys ().forEach (module => {
31+ req .keys ().forEach (( module ) => {
3232 req (module ).default ();
3333 });
3434}, module );
@@ -39,8 +39,12 @@ or if you are using Storybook v6.
3939``` javascript
4040/* .storybook/main.js */
4141module .exports = {
42- stories: [' ../stories/**/*.js' ],
43- addons: [' @storybook/addon-actions' , ' @storybook/addon-links' , ' @storybook/addon-knobs/register' ],
42+ stories: [" ../stories/**/*.js" ],
43+ addons: [
44+ " @storybook/addon-actions" ,
45+ " @storybook/addon-links" ,
46+ " @storybook/addon-knobs/register" ,
47+ ],
4448};
4549```
4650
@@ -61,9 +65,24 @@ storiesOf("My First Reason Story", _module)
6165
6266Storybook uses a reference to the ` module ` global provided by webpack to facilitate hot-reloading. We'll access that via the ` [%bs.raw] ` decorator.
6367
68+ ## Writing a CSF Story
69+
70+ If you'd prefer to use the newer [ Component Story Format] ( https://storybook.js.org/docs/formats/component-story-format/ ) , you can do that as well:
71+
72+ ``` reason
73+ open BsStorybook;
74+
75+ let default = CSF.make(~title="My CSF Story", ());
76+
77+ let button = () => <MyButton />;
78+
79+ button->CSF.addMeta(~name="Plain Button", ());
80+ ```
81+
6482## The Actions Addon
6583
6684The action addon's API is essentially unchanged from its JS implementation:
85+
6786> Make sure that you have ` @storybook/addon-actions ` in the config
6887
6988``` reason
@@ -75,6 +94,7 @@ let clickAction = Action.action("I Clicked The Button!");
7594## The Knobs Addon
7695
7796To use [ knobs] ( https://github.com/storybooks/storybook/tree/master/addons/knobs ) you have twoo ways:
97+
7898> Make sure that you have @storybook/addon-knobs /register in the config
7999
80100#### As a decorator
@@ -190,6 +210,7 @@ let obj = Knobs.object_(~label="User", ~defaultValue={"color": "grey"}, ());
190210```
191211
192212### Js.Dict
213+
193214> https://bucklescript.github.io/bucklescript/api/Js.Dict.html
194215
195216``` reason
0 commit comments