Before there was an option to handle viewport change. But now this option is deprecated. Also, there is an event about that, but this event isn't documented and maybe not implemented yet.
Please, add an option to handle viewport change or give me advice about implementation. This kind of functionality is needing for me to develop an addon for pixel-perfect markup preview.
Agreed. Please add this functionality back in. It is necessary on occasion to react to a viewport change in code that wouldn't be covered by just CSS alone.
@shilman Is it possible to pick this issue? Would like to try a first issue for this project 👍
@raufabr it's all yours! 🚀
Hi @shilman I tried setting up everything on my machine but am struggling to figure out how to set up storybook on my machine. Can you help me here?
@ndelangen can you help out @raufabr ?
@raufabr definitely! How about a call on Thursday?
I'm in the EU timzone, you can PM me on discord:
https://discord.gg/sMFvFsG
Hey @ndelangen sorry I was busy yesterday. How about today? Do you have any time? I'm based in the EU timezone as well.
Yeah I'm available right now!
In October I started building MR for this issue but had some problems with typings. By my Idea package should extend emit, on and off methods of Channel API. But declaration extending wasn't working for me. I tried some ways, but no solution was found.
Now I have time to back to the problem and there are two options:
— don't write typing
— learn more and extend typing in a different way
Do you have experience with typing extending? @raufabr what status of your MR?
https://github.com/hgenru/storybook/commit/f849cd8b29768977a3d05dfa110d0ba89b981b3d#diff-3b1024bf09c2de209faf08d3717b0269R11
@hgenru go for "don't write types" and make it work. We'll find someone to assist with the typings after!
Just add a bunch of anys,
make it work, make it right, make it fast. - in that order
@ndelangen I created PR, please look: https://github.com/storybookjs/storybook/pull/9201
Any updates here?
You should be able to subscribe to the addon's state with:
useAddonState('storybook/viewport')
(in your storyFn or decorator)
We'll however possibly change this to use global args in 6.1:
https://github.com/storybookjs/storybook/pull/11627#issuecomment-664328874
@ndelangen is this is the right way or just hack? Will event API deprecated?
Hasn't been decided yet. My proposal is to migrate it to use args, and then re-rendering should just happen automatically when the viewport changes, and you can read the current value off of args!
If you'd be keen to take a stab at this migration, I'd be happy to assist you.
You can schedule a meeting with me to get you up to speed here:
https://calendly.com/ndelangen/storybook
Most helpful comment
You should be able to subscribe to the addon's state with:
(in your storyFn or decorator)
We'll however possibly change this to use global args in 6.1:
https://github.com/storybookjs/storybook/pull/11627#issuecomment-664328874