Skip to content

Commit

Permalink
add condition to filterResult map
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Mar 4, 2024
1 parent 86c6297 commit f8c032f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
run: npm ci

- name: Build
run: npm run build
Expand Down
29 changes: 16 additions & 13 deletions components/datasets/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,22 @@ const Filter = ({ data, newFilters, fq }) => {
onChange={(e) => handleFilterSearch(e.target.value, filter)}
/>
{filterResult[filter] &&
filterResult[filter].map((item: any) => (
<button
className="filters__button"
key={item.name}
data-type={data[filter].title}
id={item.name}
onClick={handleFilterChange}
type="button"
aria-pressed="false"
>
{`${item.display_name} (${item.count})`}
</button>
))}
filterResult[filter].map((item: any) => {
if (item.name !== 'NaN')
return (
<button
className="filters__button"
key={item.name}
data-type={data[filter].title}
id={item.name}
onClick={handleFilterChange}
type="button"
aria-pressed="false"
>
{`${item.display_name} (${item.count})`}
</button>
);
})}
</div>
<ul className="filters__selected">
{dataObj[filter] &&
Expand Down

0 comments on commit f8c032f

Please sign in to comment.