Skip to content

Instantly share code, notes, and snippets.

@michaltakac
Created November 20, 2015 21:32
Show Gist options
  • Save michaltakac/f0a68dafdf95a3df8dcb to your computer and use it in GitHub Desktop.
Save michaltakac/f0a68dafdf95a3df8dcb to your computer and use it in GitHub Desktop.
Meteorboard - sidebar
import Component from 'react-pure-render/component';
import React, {PropTypes} from 'react';
import SidebarMenu from './SidebarMenu.react';
import {Image} from 'react-bootstrap';
import {Link} from 'react-router';
export default class Sidebar extends Component {
static propTypes = {
location: PropTypes.string.isRequired,
mainMenu: PropTypes.object.isRequired,
profileMenu: PropTypes.object.isRequired,
// ... another props here ...
}
render() {
const pathname = this.props.location;
const mainMenu = this.props.mainMenu.children()
.map((menu, i) => <SidebarMenu key={i} location={pathname} menu={menu} />);
const profileMenu = this.props.profileMenu.children()
.map((menu, i) => <SidebarMenu key={i} location={pathname} menu={menu} />);
return (
<div className='sidebar' id="sidebar">
<Link to='/'>
<Image circle className='profile-pic' src="img/profile/twitter-avatar.png" />
</Link>
<div className="sidebar-menu nav-collapse">
<div className="divide-20"></div>
<ul>
{profileMenu}
<div className='divide-20'></div> // small space between menus
{mainMenu}
<div className='divide-20'></div>
</ul>
</div>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment