Skip to content

Commit f535ce1

Browse files
authored
Merge pull request #21 from DSACMS/dev
Dev
2 parents ad9ac6b + ba38298 commit f535ce1

File tree

7 files changed

+63
-33
lines changed

7 files changed

+63
-33
lines changed

_includes/filters.html

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="filters-container" data-filter-target="{{ filterTarget }}">
22
<form class="usa-form usa-form--large" id="filter-form">
3-
<div class="grid-row grid-gap">
4-
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-4">
3+
<div class="filter-inputs grid-col grid-gap">
4+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
55
<label class="usa-label" for="search-input">Search</label>
66
<input
77
class="usa-input"
@@ -12,7 +12,7 @@
1212
data-filter-type="search"
1313
>
1414
</div>
15-
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-4">
15+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
1616
<label class="usa-label" for="select-status">Status</label>
1717
<select class="usa-select" id="status-select" name="status" data-filter-type="select">
1818
<option value="">All Statuses</option>
@@ -21,8 +21,17 @@
2121
{% endfor %}
2222
</select>
2323
</div>
24+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
25+
<label class="usa-label" for="agency-status">Federal Agency</label>
26+
<select class="usa-select" id="agency-select" name="agency" data-filter-type="select">
27+
<option value="">All Agencies</option>
28+
{% for agency in codegovData.agencies %}
29+
<option value="{{ agency.name }}">{{ agency.name }}</option>
30+
{% endfor %}
31+
</select>
32+
</div>
2433
{% if filterTarget == 'projects' %}
25-
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-4">
34+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
2635
<label class="usa-label" for="category-select">Category</label>
2736
<select class="usa-select" id="category-select" name="category" data-filter-type="select">
2837
<option value="">All Categories</option>
@@ -31,7 +40,7 @@
3140
{% endfor %}
3241
</select>
3342
</div>
34-
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-4">
43+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
3544
<label class="usa-label" for="language-select">Language</label>
3645
<select class="usa-select" id="language-select" name="language" data-filter-type="select">
3746
<option value="">All Languages</option>
@@ -40,7 +49,7 @@
4049
{% endfor %}
4150
</select>
4251
</div>
43-
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-4">
52+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
4453
<label class="usa-label" for="platform-select">Platform</label>
4554
<select class="usa-select" id="platform-select" name="platform" data-filter-type="select">
4655
<option value="">All Platforms</option>
@@ -50,7 +59,7 @@
5059
</select>
5160
</div>
5261
{% endif %}
53-
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-4">
62+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
5463
<label class="usa-label" for="org-select">Organization</label>
5564
<select class="usa-select" id="org-select" name="organization" data-filter-type="select">
5665
<option value="">All Organizations</option>
@@ -60,8 +69,8 @@
6069
</select>
6170
</div>
6271
</div>
63-
<div class="grid-row grid-gap margin-top-2">
64-
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-4">
72+
<div class="filter-inputs">
73+
<div class="grid-col-12 tablet:grid-col-6 desktop:grid-col-10">
6574
<label class="usa-label" for="sort-select">Sort by</label>
6675
<select class="usa-select" id="sort-select" name="sort" data-filter-type="sort">
6776
{% if filterTarget == 'agencies' %}
@@ -82,7 +91,7 @@
8291
</div>
8392
<div class="grid-row margin-top-2">
8493
<div class="grid-col-auto">
85-
<button type="button" class="usa-button usa-button--outline" id="clear-filters">
94+
<button type="button" class="filter-clear-button usa-button usa-button--outline margin-left-4" id="clear-filters">
8695
Clear Filters
8796
</button>
8897
</div>

assets/_common/js/filters.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const applySelectFilters = (data, filters, targetType) => {
3939
switch (key) {
4040
case 'organization':
4141
return item.organizations && item.organizations.includes(value);
42+
case 'agency':
43+
return item.name === value;
4244
case 'status':
4345
return true;
4446
case 'language':
@@ -66,6 +68,9 @@ const applySelectFilters = (data, filters, targetType) => {
6668
case 'platform':
6769
actualKey = 'platforms'
6870
break;
71+
case 'agency':
72+
actualKey = 'agencyName'
73+
break;
6974
}
7075

7176
if (Array.isArray(item[actualKey])) {

assets/_common/styles/_agency.scss

Lines changed: 0 additions & 14 deletions
This file was deleted.

assets/_common/styles/_category.scss

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@
139139
}
140140
}
141141

142-
143-
144142
@media screen and (max-width: 600px) {
145143
.layout--introduction {
146144
.section {
@@ -154,3 +152,35 @@
154152
}
155153
}
156154
}
155+
156+
@media screen and (min-width: 768px) {
157+
.card-and-filter-container {
158+
display: flex;
159+
width: 100vw;
160+
}
161+
162+
.filters-container {
163+
height: fit-content;
164+
background-color: #e1f3f8;
165+
border: .5px solid #565c65;
166+
}
167+
168+
.filter-inputs {
169+
display: flex;
170+
flex-direction: column;
171+
align-items: center;
172+
}
173+
174+
.agency-card,
175+
.project-card {
176+
margin: 0 1em 1em;
177+
}
178+
179+
#search-input {
180+
border: 1px solid #565c65;
181+
}
182+
183+
.filter-clear-button {
184+
background-color: #fff;
185+
}
186+
}

assets/_common/styles/styles.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Custom styling
1515
@forward "category";
1616
@forward "colors";
1717
@forward "homepage";
18-
@forward "agency";
1918

2019
@forward "overrides/code_highlight.scss";
2120
@forward "overrides/extended-header.scss";

content/agencies/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ sticky_sidenav: false
1414
templateEngineOverride: liquid, html
1515
---
1616

17-
{% include "filters.html", filterTarget: "agencies" %}
18-
1917
<script type="application/json" data-agencies>{{ codegovData.agencies | json }}</script>
2018

21-
<div class="agency-grid">
19+
<div class="card-and-filter-container">
20+
{% include "filters.html", filterTarget: "agencies" %}
21+
<div class="agency-grid"></div>
2222
</div>
2323

2424
<script src='/assets/_common/js/filters.js'></script>

content/projects/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ sticky_sidenav: false
1414
templateEngineOverride: liquid, html
1515
---
1616

17-
{% include "filters.html", filterTarget: "projects" %}
18-
1917
<script type="application/json" data-projects>{{ codegovData.projects | json }}</script>
2018

21-
<div class="project-grid"></div>
19+
<div class="card-and-filter-container">
20+
{% include "filters.html", filterTarget: "projects" %}
21+
<div class="project-grid"></div>
22+
</div>
2223

2324
<script src='/assets/_common/js/filters.js'></script>

0 commit comments

Comments
 (0)