0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-29 02:32:37 +00:00

Simplified sort arrow, removed duplicate "onClick"

This commit is contained in:
Trevor Buckner
2022-09-25 22:20:44 -04:00
parent 3754468cf4
commit 910868cfdb
3 changed files with 8 additions and 14 deletions

View File

@@ -96,7 +96,7 @@ const BrewItem = createClass({
render : function(){
const brew = this.props.brew;
if(Array.isArray(brew.tags)) { // temporary fix until dud tags are cleaned
brew.tags = brew.tags?.filter(tag => tag); //remove tags that are empty strings
brew.tags = brew.tags?.filter((tag)=>tag); //remove tags that are empty strings
}
const dateFormatString = 'YYYY-MM-DD HH:mm:ss';
@@ -112,7 +112,7 @@ const BrewItem = createClass({
<div className='brewTags' title={`Tags:\n${brew.tags.join('\n')}`}>
<i className='fas fa-tags'/>
{brew.tags.map((tag, idx)=>{
let matches = tag.match(/^(?:([^:]+):)?([^:]+)$/);
const matches = tag.match(/^(?:([^:]+):)?([^:]+)$/);
return <span className={matches[1]}>{matches[2]}</span>;
})}
</div>

View File

@@ -121,14 +121,8 @@ const ListPage = createClass({
>
{`${sortTitle}`}
</button>
{this.state.sortType == sortValue ?
<button
onClick={this.handleSortDirChange}
className='sortDir'
>
{this.state.sortDir == 'asc' ? <i className='fas fa-sort-up'></i> : <i className='fas fa-sort-down'></i>}
</button>
: ''
{this.state.sortType == sortValue &&
<i className={`sortDir fas ${this.state.sortDir == 'asc' ? 'fa-sort-up' : 'fa-sort-down'}`}></i>
}
</div>;
},

View File

@@ -74,12 +74,12 @@
color: white;
font-weight: 800;
height: 100%;
&.sortDir {
& + .sortDir {
padding-left: 5px;
}
}
}
}
.filter-option {
margin-left: 20px;
@@ -98,7 +98,7 @@
color : #ccc;
padding : 0;
}
}
}