-
-
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
Added viewport resizer #17
Conversation
return ( | ||
<div style={rootStyles}> | ||
<div style={controlsStyle}> | ||
{controls} | ||
</div> | ||
<div style={previewStyle}> | ||
{preview} | ||
<div style={toggleStyle}> |
There was a problem hiding this comment.
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?
I would like to have a different arrangement for the menu bar. I will play with this. I am not sure I can access to my devbox in the weekend. I will definitely work on this on monday if not. |
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? |
Very cool. For the UI, I like to keep them in this palce. That's fine. |
Very good stuff! |
Hey @jeef3. That look is super cool. |
Just for comparison, here's how Chrome does it: 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. |
@arunoda, I think we should transfer storybook to mantra structure ASAP so that other devs can work on adding features. |
@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. |
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. |
You can always wrap your stories with a Container Query rather than changing the viewport. Something like: http://d6u.github.io/react-container-query/ |
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 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... |
@jeef3 That's a pretty clever idea. @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. |
I agree with @namuol on this |
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. |
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. |
@timkindberg Full screen mode is implemented in the |
I've released version Then we can use native browser tools for responsive testing. I think that's a better approach. |
@arunoda , sounds good! And the |
@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. |
@smeijer I think it's best if we make a storybook decorator for this. |
@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! |
I think this is built in now.
But that only helps you on desktops, not sure how to enable this on mobile devices... |
Thanks @jeef3. It looks like full-screen mode can be entered by adding |
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: |
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. |
Update @kadira/storybook to version 2.5.2
…-12.0.0 Update eslint-config-airbnb to version 12.0.0 🚀
add the storybook-addon-jsx to the list of third party addon
* add overflow scroll to allow scrolling again Should fix the issue when scrolling breaks when using overflow: fixed. * Update index.tsx
☁️ Nx Cloud ReportCI 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 targetSent with 💌 from NxCloud. |
Features added: