Skip to content

Instantly share code, notes, and snippets.

@kosciolek
Created June 3, 2021 17:15
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 kosciolek/49a62178f5be5b3edd4110497084d058 to your computer and use it in GitHub Desktop.
Save kosciolek/49a62178f5be5b3edd4110497084d058 to your computer and use it in GitHub Desktop.
media query
export const breakpoints = {
xs: "0px",
sm: "600px",
md: "960px",
lg: "1280px",
xl: "1920px"
};
export const query = Object.entries(breakpoints).reduce(
(acc, [breakpoint, value]) => {
acc[breakpoint] = `@media screen and (min-width: ${value})`;
return acc;
},
{} as {[K in keyof typeof breakpoints]: `@media screen and (min-width: ${typeof breakpoints[K]})`}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment