mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 22:52:40 +00:00
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
require('./admin.less');
|
|
const React = require('react');
|
|
const createClass = require('create-react-class');
|
|
|
|
const BrewUtils = require('./brewUtils/brewUtils.jsx');
|
|
const NotificationUtils = require('./notificationUtils/notificationUtils.jsx');
|
|
|
|
const tabGroups = ['brew', 'notifications'];
|
|
|
|
const Admin = createClass({
|
|
getDefaultProps : function() {
|
|
return {};
|
|
},
|
|
|
|
getInitialState : function(){
|
|
return ({
|
|
currentTab : 'brew'
|
|
});
|
|
},
|
|
|
|
handleClick : function(newTab){
|
|
if(this.state.currentTab === newTab) return;
|
|
this.setState({
|
|
currentTab : newTab
|
|
});
|
|
},
|
|
|
|
render : function(){
|
|
return <div className='admin'>
|
|
|
|
<header>
|
|
<div className='container'>
|
|
<i className='fas fa-rocket' />
|
|
homebrewery admin
|
|
</div>
|
|
</header>
|
|
<div className='container'>
|
|
<div className='tabs'>
|
|
{tabGroups.map((tab)=>{ return <button onClick={()=>{ return this.handleClick(tab); }}>{tab.toUpperCase()}</button>; })}
|
|
</div>
|
|
{this.state.currentTab==='brew' && <BrewUtils />}
|
|
{this.state.currentTab==='notifications' && <NotificationUtils />}
|
|
</div>
|
|
</div>;
|
|
}
|
|
});
|
|
|
|
module.exports = Admin;
|