0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-28 04:52:40 +00:00

purty apostrophes; containerise brew collections

NB: .brewItem:nth-child(2n+1) {...} counts all children of the contain, not just the .brewItem elements.
This meant if there were an even number of published brews, the style rule got applied to the wrong unpublished brews because there's an <h1> jigging the count.
This commit is contained in:
Eric Scheid
2019-12-19 04:49:09 +11:00
committed by Trevor Buckner
parent 3259836964
commit b3376435b9

View File

@@ -42,17 +42,17 @@ const UserPage = createClass({
});
},
renderPrivateBrews : function(privateBrews){
if(!privateBrews || !privateBrews.length) return;
return [
<h1>{this.props.username}'s unpublished brews</h1>,
this.renderBrews(privateBrews)
];
},
render : function(){
const brews = this.getSortedBrews();
const publishedBrews =
<h1>{this.props.username}&rsquo;s brews</h1>
{this.renderBrews(brews.published)};
let privateBrews = '';
if(privateBrews && privateBrews.length) {
privateBrews =
<h1>{this.props.username}&rsquo;s unpublished brews</h1>
{this.renderBrews(brews.private)};
}
return <div className='userPage page'>
<Navbar>
@@ -64,9 +64,12 @@ const UserPage = createClass({
<div className='content'>
<div className='phb'>
<h1>{this.props.username}'s brews</h1>
{this.renderBrews(brews.published)}
{this.renderPrivateBrews(brews.private)}
<div className='published'>
{publishedBrews}
</div>
<div className='private'>
{privateBrews}
</div>
</div>
</div>
</div>;