Skip to content

Commit

Permalink
Removed empty filter item
Browse files Browse the repository at this point in the history
  • Loading branch information
awest25 committed Feb 7, 2024
1 parent 77c86f7 commit 8398c15
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions components/FilterList.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,20 @@ const FilterList = ({ pointsData, filterList, setFilterList }) => {
</strong>
<ul className={styles.filterValuesList} style={{ display: openKey === key ? 'block' : 'none' }}>
{uniqueValues[key].map((value) => (
<li className={styles.filterValueItem} key={value} style={{
cursor: 'pointer',
backgroundColor: isActiveFilter(key, value) ? '#8BB8E8' : ''
}}
onClick={(e) => {
e.stopPropagation(); // Prevent the click from toggling the open key
if (isActiveFilter(key, value)) {
removeFilter(key, value);
} else {
addFilter(key, value);
}
}}>{value}</li>
))}
value !== '' && (
<li className={styles.filterValueItem} key={value} style={{
cursor: 'pointer',
backgroundColor: isActiveFilter(key, value) ? '#8BB8E8' : ''
}}
onClick={(e) => {
e.stopPropagation(); // Prevent the click from toggling the open key
if (isActiveFilter(key, value)) {
removeFilter(key, value);
} else {
addFilter(key, value);
}
}}>{value}</li>
)))}
</ul>
</li>
</div>
Expand Down

0 comments on commit 8398c15

Please sign in to comment.