Created
March 4, 2020 06:39
-
-
Save Prottoy2938/1b7bf277e729a55f43444e11bd271e66 to your computer and use it in GitHub Desktop.
React JSS media query reusable component/snippet
This file contains 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
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