Skip to content

Instantly share code, notes, and snippets.

@devbyray
Created March 15, 2021 15:02
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 devbyray/21f22a71d05fab4b062ee6dc2972479d to your computer and use it in GitHub Desktop.
Save devbyray/21f22a71d05fab4b062ee6dc2972479d to your computer and use it in GitHub Desktop.
// breakpoints.{js,ts,tsx}
const size = {
xs: '320px',
sm: '768px',
lg: '1024px',
xl: '1200px',
}
const mediaQueries = (key: keyof typeof size) => {
return (style: TemplateStringsArray | String) => `@media (min-width: ${size[key]}) { ${style} }`
}
export { size, mediaQueries }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment