0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 23:52:48 +00:00

Merge pull request #2344 from naturalcrit/StyleBrewitemTags

Add Styling to Tags on userpage
This commit is contained in:
Trevor Buckner
2022-09-08 22:40:31 -04:00
committed by GitHub
2 changed files with 23 additions and 6 deletions

View File

@@ -95,6 +95,9 @@ const BrewItem = createClass({
render : function(){ render : function(){
const brew = this.props.brew; 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
}
const dateFormatString = 'YYYY-MM-DD HH:mm:ss'; const dateFormatString = 'YYYY-MM-DD HH:mm:ss';
return <div className='brewItem'> return <div className='brewItem'>
@@ -104,11 +107,15 @@ const BrewItem = createClass({
</div> </div>
<hr /> <hr />
<div className='info'> <div className='info'>
{brew.tags ? <>
<span className='brewTags' title={`Tags:\n${brew.tags.join('\n')}`}> {brew.tags?.length ? <>
<i className='fas fa-tags'/> {brew.tags.join(', ')} <div className='brewTags' title={`Tags:\n${brew.tags.join('\n')}`}>
</span> <i className='fas fa-tags'/>
<br /> {brew.tags.map((tag, idx)=>{
let matches = tag.match(/^(?:([^:]+):)?([^:]+)$/);
return <span className={matches[1]}>{matches[2]}</span>;
})}
</div>
</> : <></> </> : <></>
} }
<span title={`Authors:\n${brew.authors?.join('\n')}`}> <span title={`Authors:\n${brew.authors?.join('\n')}`}>

View File

@@ -29,13 +29,23 @@
.info{ .info{
position: initial; position: initial;
bottom: 2px; bottom: 2px;
font-family : ScalySans; font-family : ScalySansRemake;
font-size : 1.2em; font-size : 1.2em;
&>span{ &>span{
margin-right : 12px; margin-right : 12px;
line-height : 1.5em; line-height : 1.5em;
} }
} }
.brewTags span {
background-color: #c8ac6e3b;
margin: 2px;
padding: 2px;
border: 1px solid #c8ac6e;
border-radius: 4px;
white-space: nowrap;
display: inline-block;
font-weight: bold;
}
&:hover{ &:hover{
.links{ .links{
opacity : 1; opacity : 1;