Commit 4c3dad7a authored by Mattias J Duffy's avatar Mattias J Duffy
Browse files

searching by tags

parent b77e231a
Pipeline #1872 passed with stage
in 1 minute and 50 seconds
......@@ -5,8 +5,20 @@ import Grid from 'material-ui/Grid';
const CardContainer = ({searchTerm, facilities}) => {
const filterCards = (facility) => {
const lsearchTerm = searchTerm.toLowerCase()
const name = facility.facility_name.toLowerCase()
return name.includes(searchTerm.toLowerCase())
const tags = facility.facility_product_tags
tags.forEach((tag) =>{
return tag.toLowerCase()
})
let hasTag = true;
let index = tags.findIndex((tag) =>{
return tag.includes(lsearchTerm)
})
if(index === -1){
hasTag = false
}
return name.includes(lsearchTerm) || hasTag
}
// console.log(facilities)
return (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment