Adds static media query matcher for SSR scenarios#288
Adds static media query matcher for SSR scenarios#288kettanaito wants to merge 2 commits intomasterfrom
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
createMediaQuerythat's responsible for parsing a Breakpoint into a list of query params. AddscreateQueryListfunction.normalizeQueryto return a{ prefix, name, value }, which is much more flexible data structure to work with, and also a backward-compatible one.useMediaQueryhook for styled-components implementation to use the updated call signature ofjoinQueryListGitHub
Release version
Contributor's checklist
masteryarn verifyand verified the build and tests passing