Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created October 22, 2018 17:02
Show Gist options
  • Save PaulieScanlon/1ec4ba76bfe2b00803800d0529805b79 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/1ec4ba76bfe2b00803800d0529805b79 to your computer and use it in GitHub Desktop.
const onClick = (event, store) => {
store.set({ checked: !store.state.checked });
action("onClick")(event, store.state.checked);
};
stories.add(
"default usage",
withState({
checked: false
})(
withNotes(
"Button Check is a controlled component and toggles between states by receiving a `checked` boolean."
)(({ store }) => (
<ButtonCheck
checked={store.state.checked}
onClick={event => onClick(event, store)}
/>
))
)
);
stories.add(
"default & checked",
withState({
checked: true
})(
withNotes("Default with the `checked` prop.")(({ store }) => (
<ButtonCheck
checked={store.state.checked}
onClick={event => onClick(event, store)}
/>
))
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment