Commit b3f1a2c0 authored by Mattias J Duffy's avatar Mattias J Duffy

small changes to search

parent 7a8cff6b
......@@ -2,19 +2,20 @@ import React from 'react'
import {withStyles} from 'material-ui/styles';
import FacilityCard from '../containers/FacilityCard'
import Grid from 'material-ui/Grid';
import fuzzysearch from 'fuzzysearch';
const CardContainer = ({classes, searchTerm,facilities}) => {
const filterCards = (facility) => {
return facility.name.includes(searchTerm)
const name = facility.facility_name.toLowerCase()
return name.includes(searchTerm.toLowerCase())
}
console.log(searchTerm)
return (
<Grid container className={classes.root} spacing={24}>
{facilities.map(item =>
<Grid key={item.slug} item>
{facilities.filter(filterCards).map(item =>{
return(<Grid key={item.slug} item>
<FacilityCard facility={item}/>
</Grid>
)}
</Grid>)
})}
</Grid>
)
}
......
......@@ -2690,6 +2690,10 @@ function-bind@^1.0.2, function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
fuzzysearch@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/fuzzysearch/-/fuzzysearch-1.0.3.tgz#dffc80f6d6b04223f2226aa79dd194231096d008"
gauge@~2.7.3:
version "2.7.4"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
......
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