mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-19 05:08:15 +00:00
cleanup renderBrewCollection()
This commit is contained in:
@@ -233,28 +233,21 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderBrewCollection = (brewCollection)=>{
|
const renderBrewCollection = ()=>{
|
||||||
if(brewCollection.length === 0)
|
if(sortedBrewCollection.length === 0)
|
||||||
return (
|
return <h1>No Brews</h1>;
|
||||||
<div className='brewCollection'>
|
|
||||||
<h1>No Brews</h1>
|
return _.map(sortedBrewCollection, (brewGroup, idx)=>{
|
||||||
</div>
|
|
||||||
);
|
|
||||||
return _.map(brewCollection, (brewGroup, idx)=>{
|
|
||||||
const sortedBrewGroup = sortedBrewCollection[idx];
|
|
||||||
const visible = groupVisibility[brewGroup.class];
|
const visible = groupVisibility[brewGroup.class];
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<h1
|
<h1
|
||||||
className={visible ? 'active' : 'inactive'}
|
className={visible ? 'active' : 'inactive'}
|
||||||
onClick={()=>{
|
onClick={()=>toggleBrewCollectionState(brewGroup.class)}>
|
||||||
toggleBrewCollectionState(brewGroup.class);
|
|
||||||
}}>
|
|
||||||
{brewGroup.title || 'No Title'}
|
{brewGroup.title || 'No Title'}
|
||||||
</h1>
|
</h1>
|
||||||
<div key={idx} className={`brewGroup ${brewGroup.class ?? ''} ${layoutMode}`}>
|
<div key={idx} className={`brewGroup ${brewGroup.class ?? ''} ${layoutMode}`}>
|
||||||
|
{visible ? renderBrews(brewGroup.brews) : <></>}
|
||||||
{visible ? renderBrews(sortedBrewGroup.brews) : <></>}
|
|
||||||
</div>
|
</div>
|
||||||
</>);
|
</>);
|
||||||
});
|
});
|
||||||
@@ -318,7 +311,6 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI
|
|||||||
{renderTagsOptions()}
|
{renderTagsOptions()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -328,7 +320,7 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI
|
|||||||
{renderNav()}
|
{renderNav()}
|
||||||
|
|
||||||
<div className={`content V3 ${`${themeMode}Mode`}`}>
|
<div className={`content V3 ${`${themeMode}Mode`}`}>
|
||||||
<div className='brewCollection'>{renderBrewCollection(brewCollection)}</div>
|
<div className='brewCollection'>{renderBrewCollection()}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user