-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media queries don't work when using theming function #66
Comments
Looks like a bug |
Hi! Thank you for the issue, it looks like a bug with |
The same problem exists for '&:hover', '&:before' and '&:after'. |
I love this JSS plugin! Unfortunately we're experiencing the same issue. Our team has been able to work around it by providing an object which contains functions when the props/theme are needed, but I feel it would be more efficient if we could provide a function which returns a single object instead. For example (modifying the above for illustration purposes), this works: const Link = styled('a')({
color: ({ theme }) => theme.palette.primary.main
textDecoration: "none",
'&:hover': {
textDecoration: "underline"
}
}) But this does not: const Link = styled('a')(({ theme }) => ({
color: theme.palette.primary.main
textDecoration: "none",
'&:hover': {
textDecoration: "underline"
}
})) |
Still experiencing the bug with |
We are currently working on porting this implementation to v10 of jss and also moving it into |
There will be no more work done in this repo. I will add a test case for this bug for the new styled API to see if it's fixed there. |
@HenriBeck Ah okay. Amazingly quick response, thanks! |
When I provide a literal style object, media queries are considered.
If I use a theme callback instead, media queries do not work anymore:
Demo: https://codesandbox.io/s/m9v69xvo3x
Resize the output window above/below 400 pixel to see the difference: the top row switches between red and green, the bottom row doesn't.
Am I missing something conceptually here or is this supposed to work?
The text was updated successfully, but these errors were encountered: