Skip to content

Commit 775aca1

Browse files
committed
Pinned filter and search bar to the top of the page when scrolling
1 parent ff81248 commit 775aca1

3 files changed

Lines changed: 27 additions & 25 deletions

File tree

_includes/current-projects.html

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,26 @@ <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 -->
38+
<form id="search-bar">
39+
<input type="text" name="Search" id="search" placeholder="Search By Keywords">
40+
<button class="search-x" aria-label="Cancel Search" tabindex="2">
41+
<svg id="search-close" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
42+
<path d="M18 6L6 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
43+
<path d="M6 6L18 18" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
44+
</svg>
45+
</button>
46+
<button class="search-glass" aria-label="Search by Keywords" tabindex="1">
47+
<svg id="search-magnify-glass" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
48+
<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"/>
49+
</svg>
50+
</button>
51+
</form>
3652
</div>
3753
</nav>
3854

3955
<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>
5456
<div class="page-contain projects-inner" >
5557
<ul class="project-list unstyled-list"></ul>
5658
</div>

_sass/elements/_dropdown_filters.scss

Lines changed: 4 additions & 3 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;
@@ -258,9 +258,10 @@ a.clear-filter-tags {
258258

259259
.filter-toolbar {
260260
background-color: $color-pink;
261-
height: 100%;
262-
position: static;
261+
position: sticky;
263262
padding: 0;
263+
top: 64px;
264+
z-index: 99;
264265
}
265266

266267
.filtersDiv {

_sass/elements/_search-bar.scss

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,8 @@
1313
form#search-bar {
1414
position: sticky;
1515
padding: 10px;
16-
top: 60px;
17-
z-index: 10;
18-
}
19-
// // Ensure search-bar does not pin on mobile
20-
@media #{$bp-below-tablet} {
21-
form#search-bar {
22-
position: static;
23-
}
2416
}
17+
2518
//Styles to override the styles from _forms.scss
2619
#search{
2720
padding-right: 0px;
@@ -53,4 +46,10 @@ form#search-bar {
5346
padding: 0;
5447
margin: 0;
5548
border: none;
49+
}
50+
51+
@media #{$bp-below-tablet} {
52+
form#search-bar {
53+
padding: 10px;
54+
}
5655
}

0 commit comments

Comments
 (0)