mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 18:02:39 +00:00
Filtering now functional on ListPage
This commit is contained in:
@@ -138,14 +138,12 @@ const ListPage = createClass({
|
|||||||
</div>;
|
</div>;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSortedBrews : function(brewCollection){
|
getSortedBrews : function(brews){
|
||||||
const testString = _.deburr(this.state.filterString).toLowerCase();
|
const testString = _.deburr(this.state.filterString).toLowerCase();
|
||||||
console.log(testString);
|
brews = testString ? _.filter(brews, (brew)=>{
|
||||||
const brews = testString ? _.filter(brewCollection.brews, (brew)=>{
|
|
||||||
return (_.deburr(brew.title).toLowerCase().includes(testString)) ||
|
return (_.deburr(brew.title).toLowerCase().includes(testString)) ||
|
||||||
(_.deburr(brew.description).toLowerCase().includes(testString));
|
(_.deburr(brew.description).toLowerCase().includes(testString));
|
||||||
}) : brewCollection.brews;
|
}) : brews;
|
||||||
console.log(brews);
|
|
||||||
return brews;
|
return brews;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -154,7 +152,7 @@ const ListPage = createClass({
|
|||||||
return _.map(brewCollection, (brewItem, idx)=>{
|
return _.map(brewCollection, (brewItem, idx)=>{
|
||||||
return <div key={idx} className={`brewCollection${brewItem?.class ? ` ${brewItem.class}` : ''}`}>
|
return <div key={idx} className={`brewCollection${brewItem?.class ? ` ${brewItem.class}` : ''}`}>
|
||||||
<h1>{brewItem.title || 'No Title'}</h1>
|
<h1>{brewItem.title || 'No Title'}</h1>
|
||||||
{this.renderBrews(brewItem.brews)}
|
{this.renderBrews(this.getSortedBrews(brewItem.brews))}
|
||||||
</div>;
|
</div>;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user