-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Story Parameters for Official Addons #3625
Comments
|
Wow, that was fast, thanks @mshaaban088! |
Oh. Heh, I see it was done a few days ago. Still great! |
I'll have a go at the jest addon |
@renaudtertrais I am looking at the jest addon and there doesn't seem like much to change. I wondered though if we could make the DX a bit easier using parameters. My suggestion would be that rather than advising people to make a // In `.storybook/config.js`
import { addDecorator } from '@storybook/react';
import { withTests } from '@storybook/addon-jest';
import results from '../.jest-test-results.json';
addDecorator(withTests({ results }));
// In a story file
storiesOf('MyComponent', module)
.addParameters({ jest: ['MyComponent', 'MyOtherComponent'] })
.add('This story shows test results from MyComponent.test.js and MyOtherComponent.test.js', () => (
<div>Jest results in storybook</div>
)); That way we solve the problem of not wanting to import Let me know what you think. I am happy to implement the changes to make this work, or work with you to make it happen (we'll of course continue to support the previous API). |
I can work on |
Sounds great @Keraito |
How about backgrounds? |
Seems reasonable. Any reason you left it off the list @shilman? |
How's |
Sorry @tmeasday, thought I had a little bit more time on my hands. I will try to get a PR rolling by the end of this week at latest. |
No worries @Keraito. Just ping me if you do start it, otherwise I might do it soon to wrap this issue up. |
Aight, will do! |
@tmeasday so I started working on this, implemented the new parameter based pattern with the decorator, and am now writing some additional examples in the Currently, I have something like this (basically copied the first 2 stories that were already there):
Everything works fine, and the first story is inlined with the corresponding text. The second story however, throws away all the parameters I set in the |
@Keraito I think you are right. Perhaps you can make the change on this line: I'm not sure if we should use lodash |
Per key sounds enough |
@tmeasday so should I do this only for the |
@Keraito -- all keys, sorry if that was confusing ;) |
I would like to hide the addon panel of certain pages (pages which basically just render some Markdown documentation). The way how the options plugin currently works makes this quite difficult to implement because you not only have to set It would be really nice to support the options here too, like: |
Yeah, |
Yes! Let's deprecate the (Slightly more convoluted but so much more consistent!) |
@tmeasday what is important though is that if you do not add the |
Is this a problem? Can we not just make You need the decorator on all stories otherwise the At first it seems weird that a story decorator could not change the story but simply effect the UI of the manager, but if you think about it, this is what quite a few decorators do in fact (e.g. jest, notes). Perhaps its confusing, but I think a user probably isn't really thinking too hard that it's not a decorator but instead something else triggered by the story. If I was designing it from scratch I might do it a different way, but 🤷♂️ |
@tmeasday Is the idea for |
There is an advantage in parameter cascading (story parameters overriding whole-storybook or chapter parameters) -- see this comment: #3625 (comment) But yeah, mostly just to be consistent. |
Is there any progress for the option plugin? Because this issue is the last open issue in the Storybook 4.0.0 Milestone. |
I was going to look at it in the next day or two. If you are interested it could be a good contribution to make to the project? |
Yeah right but I have to say sorry. I definitely have not the time to contribute to this project right know. |
No problem! |
Let's remove storyshots from the list. It's a new functionality for it, and shouldn't block us. |
Yay! This is now done! Great team effort everyone! When I next have some free cycles I am going to look at #4010 but I agree its not a blocker for 4.0 |
Story parameters has been implemented for the notes addon in #3373
We should also implement it for other official addons as part of the 4.0 release:
The text was updated successfully, but these errors were encountered: