cssinjs / cssinjs/styled-jss

Media queries don't work when using theming function

Open
#66 9 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
214
Forks
14
PR merge metrics
No merged PRs in 30d

Description

When I provide a literal style object, media queries are considered.

```
const ResponsiveOk = styled("div")({
color: "green",
"@media screen and (min-width: 400px)": {
color: "red"
}
});
```

If I use a theme callback instead, media queries do not work anymore:
```
const ResponsiveNotOk = styled("div")(({ theme }) => ({
color: "green",
"@media screen and (min-width: 400px)": {
color: "red"
}
}));
```

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.