-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
New mobile HOC for comparing container width with breakpoints #19779
Comments
My idea of new HOC for measuring container width assumes that container width will be calculated using
Example of usage:
|
I like the idea of having a HOC or hook to take care of this, but I'm not sure the breakpoints set for |
I share your opinion, that's why I decided to have only 2 mobile breakpoints such as
I assumed you've meant passing a width which we want to compare with |
Also, there is an option to pass a width and compare it similarly to the viewport HOC:
|
I think I like that API more rather than having predefined breakpoints in the HOC. But I also can't think of more examples other than media-text right now, so I don't have enough use cases in mind to know what the right solution would be. I think I would start with allowing custom queries only, and keep an eye on how it's used and consolidate breakpoints if there are common ones being used. |
Sounds good, thanks! Will start working on that
I was discussing with @jbinda and this kind of HOC will be helpful as well in |
Is your feature request related to a problem? Please describe.
During the work over
Column
mobile block turned out that nestedMedia&Text
component is not presented in a stacked layout. The issue was caused by the wrong assumption where we were based on propertyisMobile
fromwithViewportMatch
which was calculated on device width, however, in our case, we should rely on a parentDescribe the solution you'd like
I've prepared the quick solution within a PR, however I think of a more complex solution.
Describe alternatives you've considered
The more complex proposed solution is creating new HOC for that functionality which will get a container width and compare it with breakpoints.
It should work in a similar way to existing HOC
withViewportMatch
.The text was updated successfully, but these errors were encountered: