-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Adds static media query matcher for SSR scenarios #288
base: master
Are you sure you want to change the base?
Conversation
85c57d2
to
023ac58
Compare
023ac58
to
abaf32f
Compare
Knowing all responsive props declarations of a single propI need to keep in mind that simply introducing a static alternative for There is definitely such responsive props grouping done for Caveat 1: When the responsive props should be parsed so that seemingly any part of logic could access the parsing result? It'd be inefficient to parse at each application point. |
Breakpoint/client dimensions comparison with mixed Numeric valuesCurrent implementation of the library respects Layout.configure({
defaultUnit: 'rem',
breakpoints: {
mobile: {
maxWidth: 15 // becomes "15rem",
minHeight: "500px" // stays explicit 500px
}
}
}) With this it's possible to have one breakpoint defined in numers (rems in the example above), and one in explicit measurement (i.e. "500px"—pixels). During the SSR a static media query matcher function would have to compare the actual (default breakpoint assumed on the server) and the expected (responsive prop's breakpoint, i.e. How would one compare?
Potential solutionTo solve this, Atomic Layout may bring a rule that |
c38aff8
to
c32dfa4
Compare
Changes
createMediaQuery
that's responsible for parsing a Breakpoint into a list of query params. AddscreateQueryList
function.normalizeQuery
to return a{ prefix, name, value }
, which is much more flexible data structure to work with, and also a backward-compatible one.useMediaQuery
hook for styled-components implementation to use the updated call signature ofjoinQueryList
GitHub
Release version
Contributor's checklist
master
yarn verify
and verified the build and tests passing