Skip to content

Commit

Permalink
fix: added space support for content nav filter (#1580)
Browse files Browse the repository at this point in the history
* fix: added space support for content nav filter

* fix: only modify user input for filter purposes
  • Loading branch information
finnar-bin authored Dec 2, 2022
1 parent 85749e3 commit a4f0407
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/apps/content-editor/src/app/components/Nav/ItemsFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ const ItemsFilter = (props) => {
),
}}
onChange={(evt) => {
const term = evt.target.value.trim().toLowerCase();
const term = evt.target.value;

props.setSearchTerm(term);
if (term) {
const filterTerm = term.trim().toLowerCase();

props.setFilteredItems(
props.nav.raw.filter((f) => {
return (
f.label.toLowerCase().includes(term) ||
f.path.toLowerCase().includes(term) ||
f.contentModelZUID === term ||
f.ZUID === term
f.label.toLowerCase().includes(filterTerm) ||
f.path.toLowerCase().includes(filterTerm) ||
f.contentModelZUID === filterTerm ||
f.ZUID === filterTerm
);
})
);
Expand Down

0 comments on commit a4f0407

Please sign in to comment.