-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Pattern page width (scaling live preview) #7966
Comments
I think this is the main crux of the decision around the page width and ToC. As we have patterns with large UX examples (e.g. Settings page layout), we should definitely be able to show a representative desktop UI, not a mobile responsive one, in our live code preview. |
The issue that raised my concern that the Pattern details page on staging was too wide is the size of the Useful to know images, relative to the rest of the page content - especially the annotations to the left of them. Given that these are usually zoomed-in portions of UI, I think we need these to be smaller. However, we could come up with a UX that makes these smaller without it being directly linked to the overall page width. |
Definitely need to work on that - the images are gigantic! 😅 Let's shift that discussion back to the original issue to flesh out the details. |
I'd like to hold off on changing page widths or ToC behaviour in the Patterns pages for now (unless a change is needed to align them with the rest of the Polaris site). These sorts of changes need to be made across our documentation consistently, and that means bringing Component and other documentation into designing a better experience. I don't think we should do this in the context of the Patterns project. We may have larger site-wide documentation changes in the future and we should include this as consideration into it. |
I've reverted all custom padding & widths on the Patterns page to match the rest of the pages on Polaris docs: #7994 This has re-introduced the issue of rendering the Tablet breakpoint in our live code example. From #7938:
|
Moving a conversation here from #7938 👉 The problem is that the content width forces live previews to default to tablet size and desktop width can only be seen in the sandbox. My comment from the other issue:
Here are a few scrappy visualizations:
Just exploring options. Happy to hear if there are any smarter solutions out there? |
I've been considering the same solution as you! :) Users can select zoom level, just like in Chrome's dev tools. We then use a |
My long-term suggestion (not well researched) would be to widen the default page width of our Polaris documentation so that UI renderings always get the admin's "normal width" size. Essentially, the subject of our UI documentation should dictate the space that we allocate for rendering it. In the short-term, I'd prefer either option 1 (fixed zoom that we decide) or option 2 (variable zoom, with us making a default choice per pattern/component). The scrolling behaviour feels clunkier. |
Ah, that parity is clever Sean! I'll make a separate issue for the backlog. Let's roll with popular option 2 then! Does that make sense for you @jesstelford? And is this is the only outstanding task in this issue? |
Zooming could work - I'd have to double check how that interacts with the
This option comes with the side-effect of inconsistencies across patterns. Ie; a user might copy-paste a pattern that's 100%, and everything looks good. Then they copy-paste a pattern that's 80% without realizing it was zoomed, and now their codebase looks different to the pattern, and unless they happen to know / see the "zoom" option, they're possibly going to spin off chasing a red herring rabbit hole (what a mix of metaphors!) wondering why their code makes everything look so much bigger than the examples on the website. And none of this takes into account if the user has a smaller laptop (see my 13" vs 14" image), or have resized their browser window for whatever unrelated reasons... If I were to take a step back, I'd describe our core challenge as: the user doesn't know what breakpoint they are viewing. With that in mind, I think it's more important that we convey the currently rendered breakpoint instead of allowing a zoom system. The user can then experiment with making their window thinner to see mobile breakpoints which is nice. The only problem we're left with is handling thinner screens and trying to see breakpoints that are larger than their screen can fit. This can be broken into two categories IMO:
Tailwind Awesome shows the current breakpoint (without the horizontal scroll) and it works really well! Here's a hacky attempt at what it might look like in our docs site (click the thumbnail to see the big version):
|
Thanks for the thoughtful breakdown and suggestion @jesstelford! The general direction is interesting. My one concern is if all guidance is focused on desktop width while the live preview defaults to tablet size. For example, in App settings layout we show and discuss the value of a two-column layout, but the live preview would show a single-column layout. That's the one thing that makes a scaling iframe approach appealing to me. From a dev POV, what do you think is the better tradeoff? Zooming out... The main constraint for a nice long term solution is the narrow container width. We want to fix that in the future, but it's unclear when. We will need a short term solution that makes the page viable, but we don't want to invest in it as if it was a long term solution. In other words, I think it's ok if the MVP is a bit wonky as long as it works ok. With that in mind, would it make sense to choose the solution that is the easiest to build? Visual example of the desktop + tablet size concern |
I had a sync with @SeanyB and here's our suggested path forward: Short term Long term Unless there are any objections, I will close this issue shortly, log the decision, and create a new one speccing what needs to be done. Hope this sounds good. Always open to hear other POVs! |
Closing this and moving the viewport issue to here: #8248 |
(forked from #7948): "Narrow page with to match figma prototype"
tl;dr: There's a mismatch between the page sizes used in Figma vs the actual website which have significant impact on how examples render.
The final rendered width of an example on a detail page on the docs site has a bunch of inputs:
1240px
(including 128px of padding, so content can only be1112px
).288px
*.336px
**. The ToC can be disabled on a per-page basis withshowTOC: true/false
* Including the padding
** Including the padding and gap separating it from the main column
To put it a different way, let's list out all the possible widths with the relevant breakpoints to determine how wide the content area can ever be:
With
showTOC: true
max-width: 1240px
ie;
>= 1528
1240[maxw] - 128[pad] - 336[toc]
=
776px
776 - 64[pad] - 2[border]
=
710px
ie;
> 1400
1401[scr] - 288[nav] - 128[pad] - 336[toc]
=
649px
649 - 64[pad] - 2[border]
=
583px
With
showTOC: false
max-width: 1240px
ie;
>= 1528
1240[maxw] - 128[pad]
=
1112px
1112 - 64[pad] - 2[border]
=
1046px
ie;
> 1400
1401[scr] - 288[nav] - 128[pad]
=
985px
985 - 64[pad] - 2[border]
=
919px
ToC always hidden by media query
ie;
= 1400
1400[scr] - 288[nav] - 128[pad]
=
984px
984 - 64[pad] - 2[border]
=
918px
ie;
> 769
769[scr] - 288[nav] - 128[pad]
=
353px
353 - 64[pad] - 2[border]
=
287px
ie;
= 768
768[scr] - 128[pad]
=
640px
640 - 64[pad] - 2[border]
=
574px
The Figma designs are currently using a screen resolution of
1540px
, which puts them firmly in the "hitting themax-width: 1240px
" row, BUT... it uses different padding:This padding is defined site-wide, so couldn't/shouldn't be changed without serious consideration and work.
Another thing to consider is how the site behaves on common screen widths. Interestingly, on my personal 13" MacBook Air, the ToC is automatically hidden (because the screen is slightly smaller), which results in more physical space for the text and demo, making it a better experience using the docs site!
It also means that on my 14" with ToC open, the live code preview width is thinner, pushing it just under the threshold for a smaller breakpoint size, meaning on my 14" I see a different (mobile) rendered preview than I do on my 13" (tablet) 😱
See these photos of the laptops side-by-side (13" in front, 14" behind).
One final point is thinking about how the rendered examples behave with respect to breakpoints: anything above our two smallest breakpoints (320px & 490px) will never be fully visible without horizontally scrolling (the next breakpoint up is 768px - never visible when the ToC is rendered above
1400px
).Suggested actions
The text was updated successfully, but these errors were encountered: