0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 12:22:44 +00:00

Navbar now using global scope

This commit is contained in:
Scott Tolksdorf
2016-11-14 20:15:29 -05:00
parent 4dce90ab41
commit d7463ec28e

View File

@@ -1,25 +1,21 @@
var React = require('react'); const React = require('react');
var _ = require('lodash'); const _ = require('lodash');
var Nav = require('naturalcrit/nav/nav.jsx'); const Nav = require('naturalcrit/nav/nav.jsx');
var Navbar = React.createClass({ const Navbar = React.createClass({
getDefaultProps: function() { getInitialState: function() {
return { return {
showNonChromeWarning : false,
ver : '0.0.0' ver : '0.0.0'
}; };
}, },
getInitialState: function() {
return {
showNonChromeWarning : false
};
},
componentDidMount: function() { componentDidMount: function() {
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
this.setState({ this.setState({
showNonChromeWarning : !isChrome showNonChromeWarning : !isChrome,
ver : window.version
}) })
}, },
@@ -40,7 +36,7 @@ var Navbar = React.createClass({
<Nav.item href='/' className='homebrewLogo'> <Nav.item href='/' className='homebrewLogo'>
<div>The Homebrewery</div> <div>The Homebrewery</div>
</Nav.item> </Nav.item>
<Nav.item>{`v${this.props.ver}`}</Nav.item> <Nav.item>{`v${this.state.ver}`}</Nav.item>
{this.renderChromeWarning()} {this.renderChromeWarning()}
</Nav.section> </Nav.section>