mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 22:52:39 +00:00
Tabify Admin page
This commit is contained in:
@@ -8,11 +8,38 @@ const BrewLookup = require('./brewLookup/brewLookup.jsx');
|
|||||||
const BrewCompress = require ('./brewCompress/brewCompress.jsx');
|
const BrewCompress = require ('./brewCompress/brewCompress.jsx');
|
||||||
const Stats = require('./stats/stats.jsx');
|
const Stats = require('./stats/stats.jsx');
|
||||||
|
|
||||||
|
const tabGroups = ['brews'];
|
||||||
|
|
||||||
const Admin = createClass({
|
const Admin = createClass({
|
||||||
getDefaultProps : function() {
|
getDefaultProps : function() {
|
||||||
return {};
|
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(){
|
render : function(){
|
||||||
return <div className='admin'>
|
return <div className='admin'>
|
||||||
|
|
||||||
@@ -23,13 +50,12 @@ const Admin = createClass({
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div className='container'>
|
<div className='container'>
|
||||||
<Stats />
|
<div className='tabs'>
|
||||||
<hr />
|
{tabGroups.map((name, idx)=>{
|
||||||
<BrewLookup />
|
return <button className='tab' key={idx} onClick={()=>{return this.handleClick(name);}}>{name.toUpperCase()}</button>;
|
||||||
<hr />
|
})}
|
||||||
<BrewCleanup />
|
</div>
|
||||||
<hr />
|
{this.state.currentTab == 'brews' && this.renderBrewTools()}
|
||||||
<BrewCompress />
|
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user