Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure actions to transition to a different story? #50

Closed
tlrobinson opened this issue Apr 5, 2016 · 3 comments
Closed

Configure actions to transition to a different story? #50

tlrobinson opened this issue Apr 5, 2016 · 3 comments

Comments

@tlrobinson
Copy link

It would be nice if an action could trigger a transition to a different story to simulate interactivity, similar to how you can create simple prototypes with Invision, Framer.js, etc.

For example, say you have a "Toggle" widget with two states, "on" and "off", it would be nice if you could set up the actions for each story to switch to another story to simulate the toggle actually occurring:

storiesOf('Toggle', module)
  .add('on', () => {
    return <Toggle value={true} onChange={action('onChange', 'off')} />
  })
  .add('off', () => {
    return <Toggle value={false} onChange={action('onChange', 'on')} />
  });
@arunoda
Copy link
Member

arunoda commented Apr 5, 2016

Wow. Thats a cool feature.

@arunoda
Copy link
Member

arunoda commented Apr 5, 2016

We can do it like this:

import { linkTo } from @kadira/storybook

storiesOf('Toggle', module)
  .add('on', () => {
    return <Toggle value={true} onChange={linkTo('Toggle', 'off')} />
  })
  .add('off', () => {
    return <Toggle value={false} onChange={linkTo('Toggle', 'on')} />
  });

I think this API looks great.

@arunoda
Copy link
Member

arunoda commented Apr 9, 2016

Thanks to @jeef3 's PR #86, now we've the story linking functionality.
Released with v1.8.0.

@arunoda arunoda closed this as completed Apr 9, 2016
ndelangen pushed a commit that referenced this issue Apr 5, 2017
Set NODE_ENV environment variable to development if its not set.
ndelangen pushed a commit that referenced this issue Apr 11, 2017
ndelangen pushed a commit that referenced this issue Apr 23, 2017
Adds new prop primary. It defines which Pane will keep its size.
thani-sh pushed a commit that referenced this issue May 24, 2017
Update docs for addonAPI.addPanel()
ndelangen pushed a commit that referenced this issue Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants