-
Notifications
You must be signed in to change notification settings - Fork 310
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
Set CSS rule priority based on media query break points #82
Comments
Please see the docs for the correct media query syntax https://stylexjs.com/docs/learn/styling-ui/defining-styles/#media-queries-and-other--rules |
Thanks @necolas.
gets babel transformed to
Notice What I look for is that |
@liamqma It is your responsibility to ensure that your "conditions" when applying various values for a property do not conflict. const styles = stylex.create({
foo: {
color: {
default: "red",
'@media (min-width: 10px) and (max-width: 20px)': "blue",
"@media (min-width: 20px)": "green"
}
}
}); There is an ESLint rule planned to detect conflicts and we're also discussing the possibility of automating more of this in the compiler itself. |
Thank you for clarification! |
Overlapping media queries can currently break. Use this instead: gridTemplateColumns: {
default: "repeat(4, minmax(0, 1fr))",
"@media (max-width: 1100px) and (min-width: 900px)": "repeat(3, minmax(0, 1fr))",
"@media (max-width: 900px) and (min-width: 700px)": "repeat(2, minmax(0, 1fr))",
"@media (max-width: 700px)": "1fr",
}, I know this is annoying and this will done automatically soon. |
thank you, I deleted my post since: i thought it was my fault. got it to work following the docs:
your solution is better! |
First of all, I just want to say "Awesome work". I have been looking forward to using Stylex since 2021 😃.
Is your feature request related to a problem? Please describe.
I have the below styles.
I am expecting
to be placed after
in the sheet.
However, the 👆 code gets babel transformed to
These two CSS rules have the same priority, which means the order of these two rules is indeterministic.
Describe a solution you'd like
When we calculate property property, can we consider the breakpoint value from media atrule?
Describe alternatives you've considered
I cannot think of anything alternative.
Additional context
I've raised a similar question in Compiled CSS-in-JS. atlassian-labs/compiled#1567
The text was updated successfully, but these errors were encountered: