-
Notifications
You must be signed in to change notification settings - Fork 25
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
Responsive scrollable filter bar #382
Responsive scrollable filter bar #382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the vision and am open to the possibility of using a scrollable filters container like you have implemented.
However, I feel that the scrollbar is not very intuitive to the user, i.e., not what you would find on most other sites. It will also be quite hard to use on a small screen like a mobile screen compared to a hamburger or dropdown menu, which is the very audience this change is supposed to cater to.
I would prefer a different approach but you are free to continue working on this approach and try to apply some cosideration for mobile users who don't have that much space to scroll horizontally for example left and right scroll buttons at the ends of the scrollbar.
|
||
this.breakpointSubscription = this.breakpointObserver.observe([Breakpoints.Small, Breakpoints.XSmall]).subscribe((result) => { | ||
this.isSmallScreen = result.matches; | ||
this.updateSpan(); | ||
}); | ||
|
||
this.breakpointSubscription = this.breakpointObserver.observe([Breakpoints.Medium]).subscribe((result) => { | ||
this.isMediumScreen = result.matches; | ||
this.updateSpan(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this works, would it be better to take advantage of the auto scaling capabilities of css?
We can avoid these breakpoints and corresponding values since the parent colspan of 7 scales according to screen size already, such that the children widths are always relative to the parent without changing their individual colspan or the parents.
In order to preserve the full child item being shown when the screen shrinks, consider instead using min-width/max-width css properties with media queries to shift responsiveness logic to css where possible.
overflow-x: auto; | ||
display: flex; | ||
justify-content: center; | ||
scrollbar-width: 5px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be using the firefox specific styling?
It would be better to use webkit:scrollbars pseudo-class selector in addition to this to properly style scrollbars in all browsers.
See https://stackoverflow.com/questions/15420314/how-to-make-custom-scrollbars-show-in-all-browsers
margin-right: 8px; | ||
overflow-x: auto; | ||
display: flex; | ||
justify-content: center; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for justify-content and changing it when the screen is smaller? There seems to be no difference if I remove justify content in both classes in testing.
Thank you for a better insight of the issue. The current PR uses a togglable menu approach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great implementation of a hamburger dropdown and I like the substitution of mat grid you made.
However, there is some redundancy and minor errors in regards to CSS to fix.
Additionally, would it be better to put the app-label-filters into the hamburger dropdown as well since on small screens at first glance it now seems to suggest it denotes something about all filters.
display: block; | ||
position: absolute; | ||
width: 100%; | ||
top: calc(20% + 8px); /* 8px margin from ul */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use a calculation relative to the app-filter-bar? By applying a position: relative to the app filter bar you can position the child element of class filters relative to that parent when the child has position: absolute. Therefore you could then do something like top: 100%; instead on this element and it will be positioned nicely under the filter bar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you share your reasoning behind the 8px margin from ul as commented? I find it uneccessary and it would be better to associate the expansion more closely with the app-filter-bar.
ul { | ||
margin: 8px; | ||
padding: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
list-style-type: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good substitution for the mat-grid components. Could you enforce a height of 80px so that no vertical scrollbar appears ? This was was enforced by the previous rowHeight property.
} | ||
|
||
.dropdown-filters { | ||
.search-bar { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this class necessary?
display: none; | ||
cursor: pointer; | ||
|
||
@media (max-width: 1148px) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At about 1200-1300 px range there is overlapping of components
Would it be better to use a more standard, larger breakpoint of 1400px?
Refer to https://getbootstrap.com/docs/5.0/layout/breakpoints/ for some standard breakpoints.
display: flex; | ||
align-items: center; | ||
|
||
@media (max-width: 1148px) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about breakpoints
display: inline-block; | ||
} | ||
} | ||
} | ||
|
||
.filter-item { | ||
padding: 0 10px; | ||
display: block; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need for display: block and display: inline-block? Children of flexbox are automatically given display: inline-block
Thank you for the feedback. I have moved label-filter into the hamburger dropdown as well, and done the minor fixes on css as suggested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your changes make the app a lot more usable on smaller devices. Thanks so much for your contributions!
LGTM!
Summary:
Fixes #377
Type of change:
Changes Made:
BreakpointObserver
to observe and respond to screen size changesfilter-bar
dropdown-filters
in scrollable containerScreenshots:
Proposed Commit Message:
Checklist: