0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-04 21:12:41 +00:00
Files
homebrewery/client/homebrew/navbar/account.navitem.jsx
Trevor Buckner 35e1ce0df2 Initial Commit. All seems to be working...?
EditPage.jsx and GoogleActions.js need to be cleaned up and shortened...
2020-10-05 23:33:15 -04:00

35 lines
726 B
JavaScript

const React = require('react');
const createClass = require('create-react-class');
const Nav = require('naturalcrit/nav/nav.jsx');
const Account = createClass({
getInitialState : function() {
return {
url : ''
};
},
componentDidMount : function(){
if(typeof window !== 'undefined'){
this.setState({
url : window.location.href
});
}
},
render : function(){
if(global.account){
return <Nav.item href={`/user/${global.account.username}`} color='yellow' icon='fa-user'>
{global.account.username}
</Nav.item>;
}
return <Nav.item href={`http://naturalcrit.com/login?redirect=${this.state.url}`} color='teal' icon='fa-sign-in'>
login
</Nav.item>;
}
});
module.exports = Account;