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

Added viewport resizer #17

Closed
wants to merge 5 commits into from

Conversation

kokjinsam
Copy link

Features added:

  1. Manual resizer
  2. user defined viewport size
  3. predefined viewport size

react-storybook-resizer

return (
<div style={rootStyles}>
<div style={controlsStyle}>
{controls}
</div>
<div style={previewStyle}>
{preview}
<div style={toggleStyle}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we move these button set into a seperate component?

@arunoda
Copy link
Member

arunoda commented Apr 1, 2016

I would like to have a different arrangement for the menu bar. I will play with this.
Shall we add another button to reset the viewport and take the full space. Just like the default way?

I am not sure I can access to my devbox in the weekend. I will definitely work on this on monday if not.
Everything looks great.

@kokjinsam
Copy link
Author

Yea sure. we can add the reset button. I'm also planning on adding a 'random' and 'hay' setting, just like the ones in bradfrost's ish.

So you want me to refactor toggles into another component? Where would you like to put it?

@arunoda
Copy link
Member

arunoda commented Apr 2, 2016

Very cool.

For the UI, I like to keep them in this palce. That's fine.
For a new component, just create a new file close to the layout.
May be name it as top_menu.js or something.

@LFDM
Copy link

LFDM commented Apr 3, 2016

Very good stuff!

@jeef3
Copy link
Contributor

jeef3 commented Apr 7, 2016

Very cool! I actually just forked this repo because I wanted to try and add this! 😄 Maybe draw some inspiration from Safari's responsive view?

screen shot 2016-04-07 at 2 21 31 pm

Or even Chrome's.

@arunoda
Copy link
Member

arunoda commented Apr 7, 2016

Hey @jeef3. That look is super cool.
I am super happy if we can bring this to here.

@jeef3
Copy link
Contributor

jeef3 commented Apr 7, 2016

Just for comparison, here's how Chrome does it:

screen shot 2016-04-07 at 3 04 17 pm

However, since Storybook is used to develop components, it might make less sense to have device presets. We probably care more about how our components look at a certain width in pixels, than on a certain device — that would be more for full websites of the whole application layout.

@kokjinsam
Copy link
Author

@arunoda, I think we should transfer storybook to mantra structure ASAP so that other devs can work on adding features.

@arunoda
Copy link
Member

arunoda commented Apr 7, 2016

@sammkj you mean for the source of this repo. Hmm. That's something I didn't thought.

Mantra is build for apps, but that's a good idea. I will have a look at, how it can be done.

@jeef3
Copy link
Contributor

jeef3 commented Apr 7, 2016

Was just thinking, I wonder if there could be a tidy way to pre-define the size, per component. Maybe if there was a pathway for passing options in per story?

storiesOf('My Component')
  .add('feature', { /* options */ }, () => { /* component */ });

Then you could use:

storiesOf('My Component')
  .add('feature', { initialWidth: 200 }, () => { /* component */ });

I just find that some of my components are designed to fill their container, but are meant for use within a certain size.

Of course, something like this has much bigger implications, possibly beyond the scope of this PR.

@rogchap
Copy link

rogchap commented Apr 13, 2016

You can always wrap your stories with a Container Query rather than changing the viewport. Something like: http://d6u.github.io/react-container-query/

@namuol
Copy link
Contributor

namuol commented Apr 17, 2016

Personally, I'd prefer to just use my browser's built-in responsive tools, and have Storybook's "chrome" adjust for a mobile layout. The nice benefit here is that it allows me to test on real hardware.

Storybook could fit the viewport to the window, hide menus and overlay simplified next story / prev story buttons.

Of course, this could be implemented as a custom layout, but why not just include a responsive layout by default?

@jeef3
Copy link
Contributor

jeef3 commented Apr 17, 2016

Of course, this could be implemented as a custom layout, but why not just include a responsive layout by default?

Actually, with the implementation of #115, this resizer could just be a decorator...

@arunoda
Copy link
Member

arunoda commented Apr 18, 2016

@jeef3 That's a pretty clever idea.
I think we can simply use Facebook Design's devices.

@namuol using browser tools is also a pretty nice idea. We need to find a way to just render the iframe when doing tests. May be we can do it via with a set of keyboard shortcuts.

@arunoda arunoda mentioned this pull request Apr 20, 2016
@necolas
Copy link
Contributor

necolas commented Apr 20, 2016

I agree with @namuol on this

@jeef3
Copy link
Contributor

jeef3 commented Apr 20, 2016

For me, this feature is more about testing components that fill their container, but are designed to be used at, for example, '~100px x 80px'.

I could just wrap the story in a div styled to the right size, but it would be nice to be able to adjust it to make sure it responds appropriately to container size changes — not necessarily media queries.

@timkindberg
Copy link
Contributor

I totally agree with @namuol as well. Had the same thoughts actually.

We need a quick button or key shortcut to hide all storybook UI and put the selected story into a "Full Screen" mode. The some additional minimal buttons or key shortcuts to jump to next or previous stories.

Even now if you hide the left nav and action logger there is still a small chrome around the whole viewport... so even that should go away in "Full Screen" mode.

This will be a good thing to have on it's own, plus it will help defer a mobile solution to external tools like Chrome Dev Tools.

@arunoda
Copy link
Member

arunoda commented May 5, 2016

@timkindberg Full screen mode is implemented in the mantra branch. We'll do a release within this week.

@arunoda arunoda closed this May 5, 2016
@arunoda arunoda reopened this May 5, 2016
@arunoda
Copy link
Member

arunoda commented May 5, 2016

I've released version 1.20.0. As I mentioned, in that release we've the support for full screen support. You can switch to the full screen mode with CMD + SHIFT + F or CTRL + SHIFT + F.

Then we can use native browser tools for responsive testing. I think that's a better approach.
@sammkj What do you think?

@kokjinsam
Copy link
Author

@arunoda , sounds good! And the mantra branch is awesome!

@kokjinsam kokjinsam closed this May 8, 2016
@smeijer
Copy link

smeijer commented Jul 16, 2016

@arunoda if we don't use the "native browser tools" but implement it in storybook itself, we can easier switch between different stories. I'm in favor of a "responsive toolbar" that we can show and hide in storybook. We can already resize the sidebar and the action-logger. If we can also change the location of the right edge, then we are already there.

@thani-sh
Copy link
Contributor

@smeijer I think it's best if we make a storybook decorator for this.

@leebenson
Copy link

@mnmtanish - was a decorator for toggling between full-screen navigation ever implemented?

I'd love to test my stories on a native mobile device, but it's completely unfriendly to that environment - the toolbar takes up half of the screen and accidentally clicking on the 'keyboard shortcut' helper takes over the entire screen without any means to disable it.

Would love to see the decorator, thanks!

@jeef3
Copy link
Contributor

jeef3 commented Oct 26, 2016

@mnmtanish - was a decorator for toggling between full-screen navigation ever implemented?

I think this is built in now.

⌘ ⇧ F / ⌃ ⇧ FToggle Fullscreen Mode

But that only helps you on desktops, not sure how to enable this on mobile devices...

@leebenson
Copy link

Thanks @jeef3. It looks like full-screen mode can be entered by adding ?full=1 to the URL. Would be great to have an icon on the toolbar to enable that with a click/tap. A meantime workaround would be creating a story that handles it separately and hosted it in the story list - but this seems overkill to wire up something that, IMO, should be native.

@thani-sh
Copy link
Contributor

We really do need to work on the UI to make it more mobile friendly but it might take some time. For now, I think we can fix it by making the "shortcuts helper" mobile friendly and then make shortcut info clickable as mentioned here.

Related issues:
storybook-eol/storybook-ui#10

@cpunion
Copy link

cpunion commented Jan 8, 2017

Awesome for Full Screen Mode + Device Preview, but most time I develop mobile site, I want keep the sidebar and preview in a device container, to switch pages quickly. Currently I must open two window.

@sammkj this PR is great for me, can we just extract the code to an independent library? we can use it with a decorator.

ndelangen pushed a commit that referenced this pull request Apr 5, 2017
ndelangen pushed a commit that referenced this pull request Apr 5, 2017
Update @kadira/storybook to version 2.5.2
ndelangen pushed a commit that referenced this pull request Apr 5, 2017
Tests for Panel component
ndelangen pushed a commit that referenced this pull request Apr 15, 2017
…-12.0.0

Update eslint-config-airbnb to version 12.0.0 🚀
thani-sh pushed a commit that referenced this pull request May 24, 2017
add the storybook-addon-jsx to the list of third party addon
@shilman shilman added the misc label May 27, 2017
ndelangen pushed a commit that referenced this pull request Nov 2, 2017
* add overflow scroll to allow scrolling again

Should fix the issue when scrolling breaks when using overflow: fixed.

* Update index.tsx
JReinhold added a commit that referenced this pull request May 31, 2023
Copy link

nx-cloud bot commented Jun 10, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 63d2783. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.