0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 07:12:39 +00:00

Tabify Admin page

This commit is contained in:
G.Ambatte
2024-05-10 12:38:31 +12:00
parent 9b7471d6d2
commit 1fe2a26e83

View File

@@ -8,11 +8,38 @@ const BrewLookup = require('./brewLookup/brewLookup.jsx');
const BrewCompress = require ('./brewCompress/brewCompress.jsx');
const Stats = require('./stats/stats.jsx');
const tabGroups = ['brews'];
const Admin = createClass({
getDefaultProps : function() {
return {};
},
getInitialState : function() {
return {
currentTab : 'brews'
};
},
handleClick : function(newTab) {
if(this.state.currentTab === newTab) return;
this.setState({
currentTab : newTab
});
},
renderBrewTools : function(){
return <>
<Stats />
<hr />
<BrewLookup />
<hr />
<BrewCleanup />
<hr />
<BrewCompress />
</>;
},
render : function(){
return <div className='admin'>
@@ -23,13 +50,12 @@ const Admin = createClass({
</div>
</header>
<div className='container'>
<Stats />
<hr />
<BrewLookup />
<hr />
<BrewCleanup />
<hr />
<BrewCompress />
<div className='tabs'>
{tabGroups.map((name, idx)=>{
return <button className='tab' key={idx} onClick={()=>{return this.handleClick(name);}}>{name.toUpperCase()}</button>;
})}
</div>
{this.state.currentTab == 'brews' && this.renderBrewTools()}
</div>
</div>;
}