-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Breakpoints] functions down() and between() adds +1 to index #13448
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
* Update breakpoints.md for clarity As proposed in the discussion from issue #13448 [Breakpoints] functions down() and between() adds +1 to index, the breakpoint widths are described as a range. Furthermore, I found some broken hash links that I attempted to fix. * alternative
This comment has been minimized.
This comment has been minimized.
After reading I still find it very strange to just not implement in the natural way which is
===
Why make it simple when it can be complex ? Anyways, some examples could be added for clarity or maybe improve again the doc like for instance:
===
Nothing strange, here, really ? ;-) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@guix77 What would be a correct logic? |
Maybe this ?
|
This comment has been minimized.
This comment has been minimized.
Thank you, everybody, for the feedback on this issue. The best proposal I can come up with is to change the mental model behind breakpoints. Instead of considering breakpoints as values and ranges. It will be simpler to consider them as values exclusively. In this context, This is a breaking change. We should wait for v5 to consider implementing it. The impact might be important but is limited by the fact that the usage of |
@oliviertassinari Thanks a lot for this and importantly using hooks in v4. The material-UI is now more easy to use because of hooks. |
I was wrong, Bootstrap v4 and Material-UI v4 have the same breakpoint behavior (I don't recall, but that might have influenced the current behavior). |
I've overwritten up, down, and between in theme.breakpoints as follows:
It seems to be working fine so far (and far less confusing, to my mind), but can anyone see any problems with this down the road? |
When it will be solved , I also facing this issue |
@VenomFate-619 It's already solved, you can upgrade to v5.0.0-beta.5. |
Question
Why does the breakpoints functions
down(key)
andbetween(start, end)
iterate thekey
andend
+1 ?Beheviour
If I want to style something below, say
md
(960px) for example, it adds +1 to the index and getslg
(1280px) instead. Dosen'tdown(key)
means<=key
?between(start, end)
always adds 1 to theend
index. So if you want to style something between 960px and 1280px I need to callbetween('md', 'md')
; which adds +1 to theend
index of the last argument which gives@media (min-width: 960px) (max-width: 1280px )
.Link to reproduction
Link: https://codesandbox.io/s/20w4v142lj
Context
From
createBreakpoints.js
in@material-ui/core/styles/
:The same applies to the
between(start, end)
functionEnvironment
The text was updated successfully, but these errors were encountered: