-
Notifications
You must be signed in to change notification settings - Fork 6
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
Possible to use addons? #11
Comments
Hello! It is not, but what are you wanting to do exactly? |
Hi @kirkness! I'm looking for 3 pieces of functionality that I've seen with react + storybook:
Here's a look at the implementation I'm thinking of: Let me know if you think there's a way I can achieve any of this functionality. Thanks again! |
@jesconstantine I was able to keep stories near the component. To do that I wrote a script which was going through all my components and collecting all stories into one file (it's done less than in a second) and then I just build the expobook by using that file. The content of generated file was similar to that: export default [
{
name: 'Button',
source: require('./src/components/Button/story.js'),
},
...
] To render that I specified own |
I'd need to check to be sure, but I think in theory you could: // expobook.js
import expobook from './my-expobook-instance';
export default expobook.build(); // my-expobook-instance.js
import createExpobook from 'expobook';
export default createExpobook(); And then in each of your component dirs: import expobook from '../my-expobook-instance';
expobook.add('Something', <Button />);
// Note, no need to export it. Essentially, It's the intention, but I may be wrong. |
@kirkness I believe I've tried your method but when expo loads the components are not shown in the menu. Can you take a look at my code snippets and see if I've misunderstood something? Thanks! // expobook.js
import expobook from './expobook-instance';
export default expobook.build(); // expobook-instance.js
import createExpobook from 'expobook';
export default createExpobook(); // components/Button/Button.stories.js
import React from 'react'
import expobook from '../../expobook-instance';
import Button from '../Button';
expobook.add('Button with Text', () => <Button>Text</Button>); // components/Incrementer/Incrementer.stories.js
import React from 'react';
import expobook from '../../expobook-instance';
import Incrementer from '../Incrementer';
expobook.add('Button Incrementer', () => <Incrementer buttonText={'Touch Me to increment!'}/>); |
@ezhlobo is it possible for you to share this script 🙌 like you I prefer to keep my stories close to components |
@mitramejia first of all, it was more than a year ago, so might not be workable nowadays. However there are some snippets that I think are meaningful: Scripts in package.json
Not sure why not
|
I was curious if it was possible to use storybook addons with expobook? If so, is there an example implementation that someone can point me to? Thanks!
The text was updated successfully, but these errors were encountered: