0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-16 10:22:42 +00:00

Initial functionality of basic tag filtering

This commit is contained in:
G.Ambatte
2023-12-03 09:46:02 +13:00
parent c6821819c7
commit 0762b82c40
2 changed files with 9 additions and 2 deletions

View File

@@ -46,7 +46,7 @@ const BrewItem = createClass({
}, },
updateFilter : function(type, term){ updateFilter : function(type, term){
console.log(`BrewItem: TYPE: ${type}; TERM: ${term}`); // console.log(`BrewItem: TYPE: ${type}; TERM: ${term}`);
this.props.updateListFilter(type, term); this.props.updateListFilter(type, term);
}, },

View File

@@ -82,7 +82,7 @@ const ListPage = createClass({
if(!brews || !brews.length) return <div className='noBrews'>No Brews.</div>; if(!brews || !brews.length) return <div className='noBrews'>No Brews.</div>;
return _.map(brews, (brew, idx)=>{ return _.map(brews, (brew, idx)=>{
return <BrewItem brew={brew} key={idx} reportError={this.props.reportError}/>; return <BrewItem brew={brew} key={idx} reportError={this.props.reportError} updateListFilter={this.updateListFilter}/>;
}); });
}, },
@@ -129,6 +129,7 @@ const ListPage = createClass({
}, },
handleFilterTextChange : function(e){ handleFilterTextChange : function(e){
// console.log(e);
this.setState({ this.setState({
filterString : e.target.value, filterString : e.target.value,
}); });
@@ -136,6 +137,12 @@ const ListPage = createClass({
return; return;
}, },
updateListFilter : function(type, term){
// console.log(`ListPage: TYPE: ${type}; TERM: ${term}`);
const e = { target: { value: term } };
this.handleFilterTextChange(e);
},
updateUrl : function(filterTerm, sortType, sortDir){ updateUrl : function(filterTerm, sortType, sortDir){
const url = new URL(window.location.href); const url = new URL(window.location.href);
const urlParams = new URLSearchParams(url.search); const urlParams = new URLSearchParams(url.search);