mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-10 15:42:39 +00:00
Initial functionality pass on BrewItem
This commit is contained in:
@@ -20,7 +20,8 @@ const BrewItem = createClass({
|
|||||||
authors : [],
|
authors : [],
|
||||||
stubbed : true
|
stubbed : true
|
||||||
},
|
},
|
||||||
reportError : ()=>{}
|
updateListFilter : ()=>{},
|
||||||
|
reportError : ()=>{}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -44,6 +45,11 @@ const BrewItem = createClass({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateFilter : function(type, term){
|
||||||
|
console.log(`BrewItem: TYPE: ${type}; TERM: ${term}`);
|
||||||
|
this.props.updateListFilter(type, term);
|
||||||
|
},
|
||||||
|
|
||||||
renderDeleteBrewLink : function(){
|
renderDeleteBrewLink : function(){
|
||||||
if(!this.props.brew.editId) return;
|
if(!this.props.brew.editId) return;
|
||||||
|
|
||||||
@@ -129,7 +135,7 @@ const BrewItem = createClass({
|
|||||||
<i className='fas fa-tags'/>
|
<i className='fas fa-tags'/>
|
||||||
{brew.tags.map((tag, idx)=>{
|
{brew.tags.map((tag, idx)=>{
|
||||||
const matches = tag.match(/^(?:([^:]+):)?([^:]+)$/);
|
const matches = tag.match(/^(?:([^:]+):)?([^:]+)$/);
|
||||||
return <span key={idx} className={matches[1]}>{matches[2]}</span>;
|
return <span key={idx} className={matches[1]} onClick={()=>{this.updateFilter('tag', matches[2]);}}>{matches[2]}</span>;
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</> : <></>
|
</> : <></>
|
||||||
|
|||||||
Reference in New Issue
Block a user