-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
** Why are these changes being introduced: * The result filters are awkward on a mobile display, and may only be needed for some users. Rather than having them display by default, and take up space that is very precious, we want to only show a UI control to expose them when needed. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/gdt-174 ** How does this address that need: * This adds a button above the filters panel markup, and adds a few classes to the existing markup at the top of the filters panel. * With CSS, we hide the filters panel on the smallest screens using a new hidden-sm class. This class is then toggled via javascript when the user clicks on the UI button. * The javascript is part of a new file - app/javascript/filters.js - which is loaded by the filters partial. ** Document any side effects to this change: * I'm not sure where best to add the .hidden-sm class to this codebase. For now I'm adding it to a new _layouts module. * During initial testing, it feels awkward to have competing scroll bars in the filter UI by imposing a maximum height on the panels. Because the user has now chosen explicitly to show the filters, it feels better to just have them take up the space they need, rather than making the user navigate overlapping scroll bars on a linear display. So this overrides the maximum filter panel height.
- Loading branch information
1 parent
5c22a52
commit 8714317
Showing
5 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.hidden-sm { | ||
@media (max-width: $bp-screen-sm) { | ||
display: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// These elements aren't loaded with the initial DOM, they appear later. | ||
function initFilterToggle() { | ||
var filter_toggle = document.getElementById('filter-toggle'); | ||
var filter_panel = document.getElementById('filters'); | ||
filter_toggle.addEventListener('click', event => { | ||
filter_panel.classList.toggle('hidden-sm'); | ||
filter_toggle.classList.toggle('expanded'); | ||
|
||
}); | ||
} | ||
|
||
initFilterToggle(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters