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

small changes to search

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