How to combine pseudo-selectors with media queries? #590
-
import sx from "@stylexjs/stylex"
import {color} from "~/tokens.stylex"
const styles = sx.create({
secondary: {
background: {
default: {
default: color.secondary90,
"@media (prefers-color-scheme: dark)": color.secondary10,
},
":hover": {
default: color.secondary85,
"@media (prefers-color-scheme: dark)": color.secondary15,
},
":active": {
default: color.secondary80,
"@media (prefers-color-scheme: dark)": color.secondary20,
},
},
},
}) But stylex says
I tried switching the pseudo-selector and media query around, but then stylex complains about the pseudo-selector being duplicated, instead of the media query. |
Beta Was this translation helpful? Give feedback.
Answered by
nucleartux
May 27, 2024
Replies: 2 comments 1 reply
-
Here is an example: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aspizu
-
This error should not fire. Is this an ESLint issue? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is an example:
stylex/apps/nextjs-example/app/Counter.tsx
Line 69 in b14a6ee