Skip to content

Commit ba2c4eb

Browse files
authored
Pin projects filter to top of projects list mobile view (#8196)
* Pinned filter and search bar to the top of the page when scrolling * Added a count of the filters selected to the filter bar, added clar all function and removed pills of filters to reduce clutter on mobile view * Updated the filter open view to show the filters chosen at the top * fixed gap on top of filter for consistency * cancel and apply buttons arent covered by the search bar * duplicated the search bar and gave it different classes to ba able to display it at different screen sizes * deleted message * Fix duplicate .search-bar-mobile selector * spaces on conditions for readability
1 parent 2c2c69c commit ba2c4eb

File tree

4 files changed

+198
-103
lines changed

4 files changed

+198
-103
lines changed

_includes/current-projects.html

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<nav class="filter-toolbar" aria-label="Filter Navbar">
55
<div class="filtersDiv">
66
<h3 class="filters-title">
7-
Filters
7+
<span class="filters-label-group">Filters <span id="counter_total" class="number-of-checked-boxes"></span> <a href="#" id="clear-all-filters" class="clear-filter-tags">Clear All</a></span>
88
<button class="show-filters-button" aria-label="Show All Filters">
99
<svg id='hamburger-filter-nav' width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
1010
<path d="M21.6297 12.2046H3.6297" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
@@ -33,24 +33,42 @@ <h3 class="filters-title">
3333
<div class="search-tip-link">
3434
<a href="#" id="search-tip-link">Search Tips</a>
3535
</div>
36+
37+
<!-- Search bar moved here to appear directly below the Search Tips link on mobile -->
38+
39+
<form class="search-bar-mobile">
40+
<input type="text" name="Search" id="search-mobile" class="search-input" placeholder="Search By Keywords">
41+
<button class="search-x" aria-label="Cancel Search" tabindex="2">
42+
<svg id="search-close" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
43+
<path d="M18 6L6 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
44+
<path d="M6 6L18 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
45+
</svg>
46+
</button>
47+
<button class="search-glass" aria-label="Search by Keywords" tabindex="1">
48+
<svg id="search-magnify-glass" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
49+
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.3248 12.8987L19.7048 18.2787C19.8939 18.468 20 18.7246 20 18.9921C19.9999 19.2596 19.8935 19.5161 19.7043 19.7052C19.515 19.8943 19.2584 20.0005 18.9909 20.0004C18.7234 20.0003 18.4669 19.894 18.2778 19.7047L12.8978 14.3247C11.2895 15.5704 9.26705 16.1566 7.24189 15.9641C5.21674 15.7716 3.341 14.8148 1.99625 13.2884C0.6515 11.7619 -0.0612416 9.78056 0.00301976 7.74729C0.0672812 5.71402 0.903718 3.7816 2.34217 2.34315C3.78063 0.904695 5.71305 0.0682577 7.74631 0.00399633C9.77958 -0.0602651 11.761 0.652477 13.2874 1.99723C14.8138 3.34198 15.7706 5.21772 15.9631 7.24287C16.1556 9.26802 15.5694 11.2905 14.3238 12.8987H14.3248ZM7.99977 13.9997C9.59107 13.9997 11.1172 13.3676 12.2424 12.2424C13.3676 11.1172 13.9998 9.59104 13.9998 7.99974C13.9998 6.40845 13.3676 4.88232 12.2424 3.7571C11.1172 2.63189 9.59107 1.99974 7.99977 1.99974C6.40847 1.99974 4.88235 2.63189 3.75713 3.7571C2.63191 4.88232 1.99977 6.40845 1.99977 7.99974C1.99977 9.59104 2.63191 11.1172 3.75713 12.2424C4.88235 13.3676 6.40847 13.9997 7.99977 13.9997Z" fill="#333333"/>
50+
</svg>
51+
</button>
52+
</form>
53+
3654
</div>
3755
</nav>
38-
56+
<!-- Projects and Filters container -->
3957
<div class="projects-and-filters">
40-
<form id="search-bar">
41-
<input type="text" name="Search" id="search" placeholder="Search By Keywords">
42-
<button class="search-x" aria-label="Cancel Search" tabindex="2">
43-
<svg id="search-close" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
44-
<path d="M18 6L6 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
45-
<path d="M6 6L18 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
46-
</svg>
47-
</button>
48-
<button class="search-glass" aria-label="Search by Keywords" tabindex="1">
49-
<svg id="search-magnify-glass" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
50-
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.3248 12.8987L19.7048 18.2787C19.8939 18.468 20 18.7246 20 18.9921C19.9999 19.2596 19.8935 19.5161 19.7043 19.7052C19.515 19.8943 19.2584 20.0005 18.9909 20.0004C18.7234 20.0003 18.4669 19.894 18.2778 19.7047L12.8978 14.3247C11.2895 15.5704 9.26705 16.1566 7.24189 15.9641C5.21674 15.7716 3.341 14.8148 1.99625 13.2884C0.6515 11.7619 -0.0612416 9.78056 0.00301976 7.74729C0.0672812 5.71402 0.903718 3.7816 2.34217 2.34315C3.78063 0.904695 5.71305 0.0682577 7.74631 0.00399633C9.77958 -0.0602651 11.761 0.652477 13.2874 1.99723C14.8138 3.34198 15.7706 5.21772 15.9631 7.24287C16.1556 9.26802 15.5694 11.2905 14.3238 12.8987H14.3248ZM7.99977 13.9997C9.59107 13.9997 11.1172 13.3676 12.2424 12.2424C13.3676 11.1172 13.9998 9.59104 13.9998 7.99974C13.9998 6.40845 13.3676 4.88232 12.2424 3.7571C11.1172 2.63189 9.59107 1.99974 7.99977 1.99974C6.40847 1.99974 4.88235 2.63189 3.75713 3.7571C2.63191 4.88232 1.99977 6.40845 1.99977 7.99974C1.99977 9.59104 2.63191 11.1172 3.75713 12.2424C4.88235 13.3676 6.40847 13.9997 7.99977 13.9997Z" fill="#333333"/>
51-
</svg>
52-
</button>
53-
</form>
58+
<form class="search-bar-desktop">
59+
<input type="text" name="Search" id="search-desktop" placeholder="Search By Keywords">
60+
<button class="search-x" aria-label="Cancel Search" tabindex="2">
61+
<svg id="search-close" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
62+
<path d="M18 6L6 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
63+
<path d="M6 6L18 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
64+
</svg>
65+
</button>
66+
<button class="search-glass" aria-label="Search by Keywords" tabindex="1">
67+
<svg id="search-magnify-glass" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
68+
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.3248 12.8987L19.7048 18.2787C19.8939 18.468 20 18.7246 20 18.9921C19.9999 19.2596 19.8935 19.5161 19.7043 19.7052C19.515 19.8943 19.2584 20.0005 18.9909 20.0004C18.7234 20.0003 18.4669 19.894 18.2778 19.7047L12.8978 14.3247C11.2895 15.5704 9.26705 16.1566 7.24189 15.9641C5.21674 15.7716 3.341 14.8148 1.99625 13.2884C0.6515 11.7619 -0.0612416 9.78056 0.00301976 7.74729C0.0672812 5.71402 0.903718 3.7816 2.34217 2.34315C3.78063 0.904695 5.71305 0.0682577 7.74631 0.00399633C9.77958 -0.0602651 11.761 0.652477 13.2874 1.99723C14.8138 3.34198 15.7706 5.21772 15.9631 7.24287C16.1556 9.26802 15.5694 11.2905 14.3238 12.8987H14.3248ZM7.99977 13.9997C9.59107 13.9997 11.1172 13.3676 12.2424 12.2424C13.3676 11.1172 13.9998 9.59104 13.9998 7.99974C13.9998 6.40845 13.3676 4.88232 12.2424 3.7571C11.1172 2.63189 9.59107 1.99974 7.99977 1.99974C6.40847 1.99974 4.88235 2.63189 3.75713 3.7571C2.63191 4.88232 1.99977 6.40845 1.99977 7.99974C1.99977 9.59104 2.63191 11.1172 3.75713 12.2424C4.88235 13.3676 6.40847 13.9997 7.99977 13.9997Z" fill="#333333"/>
69+
</svg>
70+
</button>
71+
</form>
5472
<div class="page-contain projects-inner" >
5573
<ul class="project-list unstyled-list"></ul>
5674
</div>

_sass/elements/_dropdown_filters.scss

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ a.filter-item {
3232
.filter-toolbar {
3333
padding: 8px 32px;
3434
box-sizing: border-box;
35-
height: calc(100vh - 60px);
35+
height: auto;
3636
position: sticky;
3737
flex-shrink: 0;
3838
top: 64px;
@@ -239,6 +239,20 @@ a.clear-filter-tags {
239239
}
240240
}
241241

242+
// Style for the Clear All link
243+
.filters-title .number-of-checked-boxes {
244+
font-size: 0.85em; // slightly smaller than heading
245+
color: $color-black; // same color as the "Filters" text
246+
margin-left: 2px;
247+
}
248+
249+
.filters-title .clear-filter-tags {
250+
margin-left: 4px; // space between counter and link
251+
white-space: nowrap;
252+
display: none; // shown via JS when filters selected
253+
color: $color-cement;
254+
}
255+
242256
.number-of-checked-boxes {
243257
color: $color-red;
244258
}
@@ -249,18 +263,23 @@ a.clear-filter-tags {
249263
//resize dropdown on tablet and mobile view
250264
section.filter-content-container {
251265
display: block;
252-
padding: 32px 16px;
266+
padding: 0 16px 32px 16px;
253267
// flex-direction: column;
254268
}
269+
// Hide applied filter tags in collapsed mobile toolbar
270+
.filter-tag-container {
271+
display: none;
272+
}
255273
.scroll-lock {
256274
overflow: hidden;
257275
}
258276

259277
.filter-toolbar {
260-
background-color: $color-pink;
261-
height: 100%;
262-
position: static;
263-
padding: 0;
278+
background-color: #f7f5f5;
279+
position: sticky;
280+
padding: 32px 0 0 0;
281+
top: 40px;
282+
z-index: 99;
264283
}
265284

266285
.filtersDiv {
@@ -277,8 +296,9 @@ a.clear-filter-tags {
277296
left: 0;
278297
bottom: 0;
279298
right: 0;
280-
overflow-y: scroll;
281299
background: $color-white;
300+
display: flex;
301+
flex-direction: column;
282302
}
283303
.filters-title {
284304
background: $color-white;
@@ -300,7 +320,8 @@ a.clear-filter-tags {
300320
border: none;
301321
}
302322
.filter-toolbar.show-filters .filter-tag-container {
303-
display: none;
323+
display: flex;
324+
flex-direction: column;
304325
}
305326
ul.filter-list {
306327
display: none;
@@ -315,17 +336,15 @@ a.clear-filter-tags {
315336

316337
.filter-toolbar.show-filters ul.filter-list {
317338
display: flex;
318-
padding: 0 12px 65px 12px;
339+
flex-grow: 1;
340+
overflow-y: auto;
341+
padding: 0 12px 20px 12px;
319342
}
320343
.filter-toolbar.show-filters .mobile-filter-buttons {
321344
display: flex;
322345
box-sizing: border-box;
323346
justify-content: space-evenly;
324-
position: fixed;
325-
bottom: 0;
326-
left: 0;
327-
right: 0;
328-
width: 100%;
347+
flex-shrink: 0;
329348
background: $color-white;
330349
padding: 8px;
331350
box-shadow: 0px -1px 4px 0px $color-mediumgrey;
@@ -363,4 +382,28 @@ a.clear-filter-tags {
363382
.show-none + .dropdown li {
364383
display: block;
365384
}
385+
386+
// Align Filters label, counter, and Clear All link
387+
.filters-label-group {
388+
display: flex;
389+
align-items: baseline;
390+
}
391+
.filters-label-group .number-of-checked-boxes {
392+
font-size: 0.85em;
393+
color: $color-black;
394+
margin-left: 4px;
395+
}
396+
.filters-label-group .clear-filter-tags {
397+
margin-left: 8px;
398+
white-space: nowrap;
399+
display: none;
400+
color: $color-cement;
401+
}
402+
}
403+
404+
@media #{$bp-tablet-up} {
405+
.filters-label-group .number-of-checked-boxes,
406+
.filters-label-group .clear-filter-tags {
407+
display: none !important; // hide on desktop
408+
}
366409
}

_sass/elements/_search-bar.scss

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,65 @@
1-
#search-bar {
2-
height: 44px;
3-
padding: 10px 16px;
4-
border-radius: 5px;
5-
border: 1px solid rgba(0, 0, 0, 0.24);
6-
display: flex;
7-
flex-direction: row;
8-
background: $color-white;
9-
gap: 4px;
10-
margin-bottom: 10px;
11-
}
121

13-
form#search-bar {
14-
position: sticky;
15-
padding: 10px;
16-
top: 60px;
17-
z-index: 10;
2+
3+
/* Search bar container (was #search-bar) */
4+
.search-bar-desktop,
5+
.search-bar-mobile {
6+
height: 44px;
7+
padding: 10px 16px;
8+
border-radius: 5px;
9+
border: 1px solid rgba(0, 0, 0, 0.24);
10+
display: flex;
11+
flex-direction: row;
12+
background: $color-white;
13+
gap: 4px;
14+
margin-bottom: 10px;
1815
}
19-
// // Ensure search-bar does not pin on mobile
20-
@media #{$bp-below-tablet} {
21-
form#search-bar {
22-
position: static;
23-
}
16+
17+
/* Override _forms.scss (was #search) */
18+
#search-desktop,
19+
#search-mobile {
20+
padding-right: 0px;
21+
padding-left: 0px;
22+
appearance: none;
23+
background: $color-white;
24+
border: none;
25+
border-radius: 0px;
26+
box-shadow: none;
27+
color: $color-black;
28+
font-size: 1rem;
29+
height: 22px;
30+
margin-bottom: 10px;
31+
width: 100%;
2432
}
25-
//Styles to override the styles from _forms.scss
26-
#search{
27-
padding-right: 0px;
28-
padding-left: 0px;
29-
appearance: none;
30-
background: $color-white;
31-
border: none;
32-
border-radius: 0px;
33-
box-shadow: none;
34-
color: $color-black;
35-
font-size: 1rem;
36-
height: 22px;
37-
margin-bottom: 10px;
38-
width: 100%;
33+
34+
/* Buttons */
35+
.search-x,
36+
.search-glass {
37+
width: 24px;
38+
height: 24px;
39+
padding: 0;
40+
margin: 0;
41+
border: none;
3942
}
4043

4144
.search-x {
42-
width: 24px;
43-
height: 24px;
44-
padding: 0;
45-
margin: 0;
46-
display: none;
47-
border:none;
45+
display: none;
4846
}
4947

50-
.search-glass {
51-
width: 24px;
52-
height: 24px;
53-
padding: 0;
54-
margin: 0;
55-
border: none;
56-
}
48+
49+
50+
/* Mobile and below: show mobile search bar only (unchanged behaviour) */
51+
@media #{$bp-below-tablet} {
52+
.search-bar-desktop { display: none; }
53+
.search-bar-mobile { display: flex; position: static; }
54+
}
55+
56+
/* Desktop and up: show desktop search bar; sticky below header */
57+
@media #{$bp-desktop-up} {
58+
.search-bar-mobile { display: none; }
59+
.search-bar-desktop {
60+
display: flex;
61+
position: sticky;
62+
top: 61px;
63+
z-index: 90;
64+
}
65+
}

0 commit comments

Comments
 (0)