Skip to content

Commit

Permalink
filtered unintended commas out of cardList (hackforla#1601)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesberke authored May 21, 2021
1 parent 23296bf commit ed22cab
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pages/wins/wins.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,23 @@
}
}


function insertIcons(cloneCardTemplate, cardClass, cardString) {
let cardList = cardString.split(',').map(item => item.trim())
let initialCardList = cardString.split(',').map(item => item.trim())
let otherWinsText = [];
let cardList = [];

initialCardList.forEach(win => {
if (badgeIcons.hasOwnProperty(win)){
cardList.push(win);
} else if (win === " "){
return
} else {
otherWinsText.push(win);
}
});
cardList.push(otherWinsText.join(", "));

const SVG_FILE_PATH = `/assets/images/wins-page/wins-badges/`

cardList.map(function (item) {
Expand Down Expand Up @@ -479,6 +494,7 @@
const item = string.trim()
const SVG_FILE_PATH = `/assets/images/wins-page/wins-badges/`


if (badgeIcons.hasOwnProperty(item)) {
cloneCardTemplate.insertAdjacentHTML('beforeend',
`<div class='overlay-item-container'>
Expand All @@ -498,6 +514,7 @@
)
return
}

})
}

Expand Down

0 comments on commit ed22cab

Please sign in to comment.