It provides helpers for easier creating books with Storybook.
import { storiesOf } from 'dreact/helper-book'For addon-knobs
For addon-actions
-
Component to render the title in stories
-
Components to organize multiple items in one story
-
It allows creating stories with local state inside:
import { withState } from 'dreact/helper-book' export default { title: 'Example', } export function Default() { return pug` p Hello, I'm a default message ` } const initialState = { visible: false } export const Example = withState(initialState, ({ state }) => { return pug` button(onClick=() => state.toggle('visible')) Toggle = state.get('visible') ? 'Visible' : 'Hidden' ` })
statehas the following interface:state.set(updates) // `updates` will be passedd to `this.setState`
state.get([key]) // Will return the whole state or the value related to `key`
state.toggle(key) // Will get value for key and set the negated version