Created
August 12, 2020 21:45
-
-
Save pablohdzvizcarra/b29b067cf491a023ee03d2ecc2b30213 to your computer and use it in GitHub Desktop.
how to make your style components with response to the screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { breakpoints } from "./_variables"; | |
import { css } from "styled-components"; | |
export const respondTo = Object.keys(breakpoints).reduce( | |
(accumulator, label) => { | |
accumulator[label] = (...args) => css` | |
@media (min-width: ${breakpoints[label]}) { | |
${css(...args)}; | |
} | |
`; | |
return accumulator; | |
}, | |
{} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment