Skip to content

Instantly share code, notes, and snippets.

@Prottoy2938
Created March 4, 2020 06:39
Show Gist options
  • Save Prottoy2938/1b7bf277e729a55f43444e11bd271e66 to your computer and use it in GitHub Desktop.
Save Prottoy2938/1b7bf277e729a55f43444e11bd271e66 to your computer and use it in GitHub Desktop.
React JSS media query reusable component/snippet
export default {
up() {},
down(size) {
const sizes = {
xs: "575.98px",
sm: "767.98px",
md: "991.98px",
lg: "1199.98px",
xl: "1600px",
}
return `@media (max-width: ${sizes[size]})`
},
}
//how to use-
//In your react jss style file, import the module.
//In your jss code-
// root: {
// width: "75vw",
// [sizes.down("lg")]: {
// width: "80vw",
// },
// [sizes.down("md")]: {
// width: "100vw",
// },
// [sizes.down("sm")]: {
// fontSize:"10px"
// },
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment