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

How to set addon-viewport viewport default value #2395

Closed
zhipenglin opened this issue Nov 29, 2017 · 8 comments
Closed

How to set addon-viewport viewport default value #2395

zhipenglin opened this issue Nov 29, 2017 · 8 comments

Comments

@zhipenglin
Copy link

This plugin is very good , but I can not set a default value for its viewport so that it remembers the previously selected value the next time it opens

@danielduan
Copy link
Member

danielduan commented Dec 8, 2017

This will probably require a PR to set something in the cookies or browser local storage.

Feel free to contribute if you'd like to see this feature somewhere.

@jalooc
Copy link

jalooc commented Jan 11, 2018

Do you think it would it be possible to export a configuration function setting default values, like e.g. setOptions in @storybook/addon-options?

@mneumark
Copy link

Actually it would be great to set this per-story. So if I have a story I am trying to show that is intended just for mobile and looks terrible on desktop. Have a decorator option to set it.

@francesco-albanese
Copy link

Any news on that? It would be really useful if one could pass a config to set the default viewport by default.

@igor-dv
Copy link
Member

igor-dv commented Feb 28, 2018

There is an ongoing PR - #3099.

@mshaaban088
Copy link
Contributor

mshaaban088 commented Mar 1, 2018

I agree, it'd be great to have those features, so I'll take it and address the following:

  1. Export an option to configure the default viewport @francesco-albanese @jalooc
  2. Export a decorator component to override the default viewport per story @mneumark

I think with option 1, we don't need to use cookie/local-storage, as it will be set for the entire website/stories @zhipenglin @danielduan

What do you think folks?

P.S. it'll be a separate PR though @igor-dv , and it might needs some adjustments on #3099

@mshaaban088
Copy link
Contributor

Just a quick update, I've implemented the above functionality (see #3099), in case you want to see how it is implemented. Feedbacks are always welcomed!

@Hypnosphi
Copy link
Member

Released as 4.0.0-alpha.0

@issue-sh issue-sh bot removed the merged label Mar 29, 2018
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

8 participants