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

Multiple Preview Windows #1335

Closed
shilman opened this issue Jun 22, 2017 · 10 comments
Closed

Multiple Preview Windows #1335

shilman opened this issue Jun 22, 2017 · 10 comments

Comments

@shilman
Copy link
Member

shilman commented Jun 22, 2017

why

It is nice to be able to see many story previews at once. I can think of two main use cases for this:

  1. I've seen many Storybooks that contain stories like this one:

storybook

Lonely Planet implements this as a single story, but it would be a lot cleaner if it could be implemented as five different stories, that are displayed on the same page.

  1. A second use case is something like https://sizzy.co/, but for components, where we can show a single component rendered responsively on multiple device sizes at once:

fullscreen_6_22_17__9_08_pm

what

I don't have a particular implementation in mind, but am writing this up for @alexandrebodin who is interested in making the Storybook UI pluggable. I think this could be layered as a plugin on top of a deeper story hierarchy, such as #1329

@alexandrebodin
Copy link
Contributor

❤️

@ghost
Copy link

ghost commented Jun 24, 2017

+1

I was just going to suggest this idea but chose to check the issues in case someone else got there first. I basically would like something similar to what Chrome offers when dev tools are open: a configurable set (probably with some common sizes out of the box) of sized preview panes/boxes/viewports for showing the same component in multiple things at once like an iPhone 5 and an iPhone 7 and a Samsung S6, etc.

@stale
Copy link

stale bot commented Oct 31, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. We do try to do some housekeeping every once in a while so inactive issues will get closed after 90 days. Thanks!

@stale stale bot added the inactive label Oct 31, 2017
@stale
Copy link

stale bot commented Nov 2, 2017

Hey there, it's me again! I am going to help our maintainers close this issue so they can focus on development efforts instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Nov 2, 2017
@OliverJAsh
Copy link

A second use case is something like https://sizzy.co/, but for components, where we can show a single component rendered responsively on multiple device sizes at once:

I really want this feature, but I'm not sure how it would work.

We would need to "mock" the window width for each size variation of the component. The only way I know of achieving this is with iframes. However, the issue with iframes is that are isolated from the page's styles, so we'd have to inject styles into each iframe, somehow. This could quickly become a performance problem, if you're rendering several iframes at the same time, each with their own styling (+ any logic for HMR).

@arthur5005
Copy link

Working on components with multiple viewports at once would be great.

@shilman
Copy link
Member Author

shilman commented Nov 20, 2019

You can hack addon-docs to do something like this pretty easily, although it's not what the feature is intended for: https://github.com/storybookjs/storybook/blob/next/addons/docs/docs/mdx.md

@PutziSan
Copy link

A second use case is something like https://sizzy.co/, but for components, where we can show a single component rendered responsively on multiple device sizes at once:

Yep, this would be really awesome!

You can hack addon-docs to do something like this pretty easily, although it's not what the feature is intended for: https://github.com/storybookjs/storybook/blob/next/addons/docs/docs/mdx.md

I don't know this, I took a quick look at it, but unfortunately I have no idea how to use it straightaway.
Could you perhaps give a first kick-off or mini example of how and where to use addon-docs to display multiple viewports in a storbook?

@shilman
Copy link
Member Author

shilman commented Nov 25, 2019

@PutziSan Sure, I can do that. Can you provide some static HTML of what a good implementation might look like, and I can privide a POC using SB Docs?

@PutziSan
Copy link

@shilman That would be really awesome!
I made the most basic variant I came up with in a code-sandbox in react. If you only wanted the static HTML, you could copy it out with the dev-tools, otherwise let me know if you need something else or if it's not what you imagined.
https://codesandbox.io/s/gifted-brattain-1fxwf

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

5 participants