Skip to content

Commit

Permalink
refactor resource filtering to trim filter values
Browse files Browse the repository at this point in the history
  • Loading branch information
aashimgarg committed Feb 16, 2024
1 parent 8137ccf commit 38f1187
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const Resources = ({ data }) => {
{ value: 'Reports', label: 'Reports' },
{ value: 'Blog', label: 'Blog' },
{ value: 'Published Papers', label: 'Published Papers' },
{ value: 'Guidebook ', label: 'Guidebook ' }
{ value: 'Guidebook', label: 'Guidebook' }
];

const sectors = [
Expand All @@ -178,8 +178,8 @@ const Resources = ({ data }) => {
};

const filteredResources = allResources.filter((resource) => {
const filterByType = !TypeFilter || TypeFilter.value === 'All' || resource.type === TypeFilter.value;
const filterBySector = !sectorFilter || sectorFilter.value === 'All' || resource.sector === sectorFilter.value;
const filterByType = !TypeFilter || TypeFilter.value === 'All' || resource.type === TypeFilter.value.trim();
const filterBySector = !sectorFilter || sectorFilter.value === 'All' || resource.sector === sectorFilter.value.trim();
return filterByType && filterBySector;
});

Expand Down

0 comments on commit 38f1187

Please sign in to comment.