-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
[Gatsby Docs Update] Sidebar + article layout updates #10735
Changes from 1 commit
38c6a41
5bc539e
547f651
fee9ec5
cd8f984
4dc9855
89c8d69
749c27a
43b588c
fe459b3
7e7ee1c
5e4dda9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,29 +35,35 @@ const colors = { | |
black: '#000000', | ||
}; | ||
|
||
const SIZES = { | ||
let SIZES = { | ||
xsmall: {min: 0, max: 599}, | ||
small: {min: 600, max: 739}, | ||
medium: {min: 740, max: 979}, | ||
large: {min: 980, max: 1279}, | ||
xlarge: {min: 1280, max: 1339}, | ||
xxlarge: {min: 1340, max: Infinity}, | ||
}; | ||
|
||
// Tweakpoints | ||
xlargeSmaller: {min: 1100, max: 1339}, | ||
belowSidebarFixed: {min: 740, max: 1559}, // Used for "between()" | ||
// Tweakpoints | ||
SIZES = { | ||
...SIZES, | ||
largerSidebar: {min: 1100, max: SIZES.xlarge.max}, | ||
sidebarFixed: {min: 1560, max: Infinity}, | ||
sidebarFixedNarrowFooter: {min: 1560, max: 2000}, | ||
}; | ||
|
||
type Size = $Keys<typeof SIZES>; | ||
|
||
const media = { | ||
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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this conditional correct? Or did you mean to have an Calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it was logically correct, but it wasn't nice to read. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still confused. Isn't a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah... I see now that you're using |
||
return `@media (min-width: ${SIZES[smallKey].min}px)`; | ||
} else { | ||
return `@media (min-width: ${SIZES[smallKey].min}px) and (max-width: ${SIZES[largeKey].max}px)`; | ||
if (excludeLarge) { | ||
return `@media (min-width: ${SIZES[smallKey].min}px) and (max-width: ${SIZES[largeKey].min - 1}px)`; | ||
} else { | ||
return `@media (min-width: ${SIZES[smallKey].min}px) and (max-width: ${SIZES[largeKey].max}px)`; | ||
} | ||
} | ||
}, | ||
|
||
|
@@ -145,7 +151,7 @@ const sharedStyles = { | |
marginLeft: 80, | ||
}, | ||
|
||
[media.between('small', 'xlargeSmaller')]: { | ||
[media.between('small', 'largerSidebar')]: { | ||
flex: '0 0 200px', | ||
marginLeft: 80, | ||
}, | ||
|
@@ -154,7 +160,7 @@ const sharedStyles = { | |
marginLeft: 40, | ||
}, | ||
|
||
[media.greaterThan('xlargeSmaller')]: { | ||
[media.greaterThan('largerSidebar')]: { | ||
flex: '0 0 300px', | ||
}, | ||
|
||
|
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍