Files
freeCodeCamp/common/app/components/Nav/Nav.jsx

79 lines
1.6 KiB
React
Raw Normal View History

2015-06-17 21:04:28 -07:00
import React from 'react';
import { Nav, Navbar, NavItem } from 'react-bootstrap';
import FCCNavItem from './NavItem.jsx';
2015-06-04 10:53:01 -07:00
2015-06-17 21:04:28 -07:00
export default class extends React.Component {
constructor(props) {
super(props);
}
2015-06-04 10:53:01 -07:00
2015-06-17 21:04:28 -07:00
static displayName = 'Nav'
static propTypes = {
signedIn: React.PropTypes.bool
}
2015-06-04 10:53:01 -07:00
2015-06-17 21:04:28 -07:00
renderBrand() {
2015-06-04 10:53:01 -07:00
var fCClogo = 'https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg';
return (
<a href='/'>
<img
alt='learn to code javascript at Free Code Camp logo'
2015-06-17 21:04:28 -07:00
className='img-responsive nav-logo'
src={ fCClogo } />
2015-06-04 10:53:01 -07:00
</a>
);
2015-06-17 21:04:28 -07:00
}
2015-06-04 10:53:01 -07:00
2015-06-17 21:04:28 -07:00
renderSignin() {
2015-06-04 10:53:01 -07:00
if (this.props.signedIn) {
return (
<NavItem
eventKey={ 2 }>
Show Picture
</NavItem>
);
} else {
return (
<FCCNavItem
2015-06-29 09:50:25 -07:00
className='btn signup-btn signup-btn-nav'
2015-06-04 10:53:01 -07:00
eventKey={ 2 }
2015-06-17 21:04:28 -07:00
href='/login'>
Sign In
</FCCNavItem>
2015-06-04 10:53:01 -07:00
);
}
2015-06-17 21:04:28 -07:00
}
2015-06-04 10:53:01 -07:00
2015-06-17 21:04:28 -07:00
render() {
2015-06-04 10:53:01 -07:00
return (
<Navbar
2015-07-03 17:46:58 -07:00
brand={ this.renderBrand() }
2015-06-17 21:04:28 -07:00
className='nav-height'
2015-06-04 10:53:01 -07:00
fixedTop={ true }
2015-06-17 21:04:28 -07:00
toggleNavKey={ 0 }>
2015-06-04 10:53:01 -07:00
<Nav
2015-06-17 21:04:28 -07:00
className='hamburger-dropdown'
2015-06-04 10:53:01 -07:00
eventKey={ 0 }
2015-06-17 21:04:28 -07:00
right={ true }>
2015-06-04 10:53:01 -07:00
<NavItem
eventKey={ 1 }
href='/Challenges'>
Challenges
</NavItem>
<NavItem
eventKey={ 1 }
href='Chat'>
Chat
</NavItem>
<NavItem
eventKey={ 2 }
href='/bonfires'>
Bonfires
</NavItem>
2015-07-03 17:46:58 -07:00
{ this.renderSignin() }
2015-06-04 10:53:01 -07:00
</Nav>
</Navbar>
);
}
2015-06-17 21:04:28 -07:00
}