Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablohdzvizcarra/b29b067cf491a023ee03d2ecc2b30213 to your computer and use it in GitHub Desktop.
Save pablohdzvizcarra/b29b067cf491a023ee03d2ecc2b30213 to your computer and use it in GitHub Desktop.
how to make your style components with response to the screen
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