Skip to content

Commit

Permalink
MWPW-156066 - do not display empty li el as sort/filter item
Browse files Browse the repository at this point in the history
  • Loading branch information
draganalilly021 committed Aug 6, 2024
1 parent 2754458 commit 4d90f40
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions edsdme/components/PartnerCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ export default class PartnerCards extends LitElement {
filter: (cols) => {
const [filterKeyEl, filterTagsKeysEl] = cols;
const filterKey = filterKeyEl.innerText.trim().toLowerCase().replace(/ /g, '-');
const filterTagsKeys = Array.from(filterTagsKeysEl.querySelectorAll('li'), (li) => li.innerText.trim().toLowerCase().replace(/ /g, '-'));

const filterTagsKeys = [];
filterTagsKeysEl.querySelectorAll('li').forEach((li) => {
const key = li.innerText.trim().toLowerCase().replace(/ /g, '-');
if (key !== '') filterTagsKeys.push(key);
});

if (!filterKey || !filterTagsKeys.length) return;

Expand All @@ -103,7 +108,12 @@ export default class PartnerCards extends LitElement {
},
sort: (cols) => {
const [sortKeysEl] = cols;
const sortKeys = Array.from(sortKeysEl.querySelectorAll('li'), (li) => li.innerText.trim().toLowerCase().replace(/ /g, '-'));

const sortKeys = [];
sortKeysEl.querySelectorAll('li').forEach((li) => {
const key = li.innerText.trim().toLowerCase().replace(/ /g, '-');
if (key !== '') sortKeys.push(key);
});

if (!sortKeys.length) return;

Expand Down

0 comments on commit 4d90f40

Please sign in to comment.