[Gatsby Docs Update] Sidebar + article layout updates#10735
[Gatsby Docs Update] Sidebar + article layout updates#10735bvaughn merged 12 commits intofacebook:gatsbyfrom
Conversation
**what is the change?:** - Adds media queries and JS to make sidebar collapse/expand from a sticky bottom bar on small screen sizes - Many TODOs still open! This is just an initial version. **why make this change?:** Moving closer to Joe's fantastic design. :) **test plan:** Manual testing - Flarnie will insert a gif **issue:** Various items under the `Sidebar Component` on this checklist; https://github.com/bvaughn/react/wiki/Gatsby-check-list
**what is the change?:** We skim the items in the 'defaultActiveSection' to find the currently active one, and display it's title in the sticky responsive bottom navbar. Before I had just plugged in the section title as a placeholder. **why make this change?:** It's better this way. One step closer to Joe's shiny new design. :) **test plan:** Manually tested (Flarnie will insert a screenshot) **issue:** Sidebar items on this checklist; https://github.com/bvaughn/react/wiki/Gatsby-check-list
|
Deploy preview ready! Built with commit 4f1839e |
5729ebb to
28f8881
Compare
bvaughn
left a comment
There was a problem hiding this comment.
CI's failing b'c of formatting issues. 😄
Mind running yarn prettier-all (in the root of the project) to fix them up?
28f8881 to
4f1839e
Compare
4f1839e to
63d9f83
Compare
16eeca3 to
0472658
Compare
0472658 to
89c8d69
Compare
| maxWidth: isFooter ? 800 : 1260, | ||
| paddingLeft: isFooter ? 0 : 20, | ||
| paddingRight: isFooter ? 0 : 20, | ||
| }, |
There was a problem hiding this comment.
Maybe rather than passing in isFooter we could support additional custom CSS? (Since only one instance of Container would have the footer CSS).
There was a problem hiding this comment.
Good shout, feels nicer to compose. Changed :)
| }} | ||
| to="/"> | ||
| <img src={logoSvg} alt="React" height="20" /> | ||
| <img src={logoSvg} alt="" height="20" /> |
There was a problem hiding this comment.
Why'd the "alt" get removed? Accident?
There was a problem hiding this comment.
aXe was picking it up that it was a duplicate of the title; which is apparently an anti-pattern. Empty alt tags are used for presentational img tags, so I think we're good 👍
There was a problem hiding this comment.
aXe was picking it up that it was a duplicate of the title; which is apparently an anti-pattern
I have never heard this. Interesting. So it's best to explicitly specify an empty alt attribute vs none at all in this case?
Upon further consideration, I think images used as links should have alt text describing the destination of the link, not the image itself. So maybe this one should say something like, "React home page"? Oh, I see what you're saying now.
| width: 1, | ||
| margin: -1, | ||
| padding: 0, | ||
| border: 0, |
There was a problem hiding this comment.
Due to the lack of alt attribute (see the other comment), we still want the site title to be read if the crawler is using mobile
There was a problem hiding this comment.
Gotcha. This is gross. 😛 But I think your logic is reasonable. The grossness is just browser stuff. 😁
There was a problem hiding this comment.
I might look into changing the markup slightly after this is merged to avoid this if you don't oppose it.
| [media.between('large', 'xlargeSmaller')]: { | ||
| paddingRight: 280, | ||
| }, | ||
| [media.between('xlargeSmaller', 'belowSidebarFixed')]: { |
There was a problem hiding this comment.
I'm not sure I care for the newly-added media constants. The API was kind of built to make sense with sizes but the new strings are kind of more arbitrary. This query particular is pretty confusing. 😁 What does it mean to be between xlargerSmaller and belowSidebarFixed?
| xlargeSmaller: {min: 1100, max: 1339}, | ||
| belowSidebarFixed: {min: 740, max: 1559}, // Used for "between()" | ||
| sidebarFixed: {min: 1560, max: Infinity}, | ||
| sidebarFixedNarrowFooter: {min: 1560, max: 2000}, |
There was a problem hiding this comment.
I don't think these constants make sense, (paricularly xlargeSmaller 😁 ), with the way the sizes were designed. If we need these new sizes, then I think we should pick a few hard-coded media query values rather than try to make them work within the media methods.
There was a problem hiding this comment.
See my latest commit. I've not removed them entirely, as I think it's good to have all width constraints in one central place, but I've made it more obvious about what they're actually doing. And was able to remove belowSidebarFixed due to the new "excludeLarge" on the between function 👍
| render() { | ||
| const {defaultActiveSection, location} = this.props; | ||
| console.log('the defaultActiveSection is ;', defaultActiveSection); | ||
| console.log('this.props are ', this.props); |
There was a problem hiding this comment.
These probably weren't intended to be left in ^
| return ( | ||
| <Link | ||
| css={[linkCss, isItemActive(location, item) && activeLinkCss]} | ||
| css={[linkCss, isActive && activeLinkCss]} |
There was a problem hiding this comment.
This isActive change is good 👍 Thanks
www/src/theme.js
Outdated
| darker: '#20232a', // really dark blue | ||
| brand: '#61dafb', // electric blue | ||
| brandLight: '#bbeffd', | ||
| brandOnWhite: '#10819b', |
There was a problem hiding this comment.
this was actually an artefact, so now removed :)
| text: '#1a1a1a', // very dark grey / black substitute | ||
| subtle: '#777', // light grey for text | ||
| subtle: '#6d6d6d', // light grey for text | ||
| subtleOnDark: '#999', |
There was a problem hiding this comment.
I think subtleOnDark is nicely verbose in this instance, showing it's for use on dark backgrounds. Would you agree?
There was a problem hiding this comment.
Sure that's okay 😄 Feel free to ignore "nit" comments
www/src/theme.js
Outdated
| between(smallKey: Size, largeKey: Size) { | ||
| if (SIZES[largeKey].max === Infinity) { | ||
| between(smallKey: Size, largeKey: Size, excludeLarge: Boolean = false) { | ||
| if (SIZES[largeKey].max === Infinity && !excludeLarge) { |
There was a problem hiding this comment.
Is this conditional correct? Or did you mean to have an || instead of an &&?
Calling between(small, large, true) would create a media query with max-width even if the max size was Infinity. When would we want that?
There was a problem hiding this comment.
I think it was logically correct, but it wasn't nice to read. excludeLarge is an exception because you're not concerned about the max property. So I've refactored it — 5e4dda9
There was a problem hiding this comment.
I'm still confused. Isn't a max-width of Infinity the same as no max-width at all?
There was a problem hiding this comment.
Ah... I see now that you're using ${SIZES[largeKey].min} below. Hm.
|
Let's follow-up on the other PR comments later. Merging for now to help get the Netlify build working. 😄 |
This supersedes #10707
what are the changes?:
sticky bottom bar on small screen sizes
why make these changes?
test plan