Created
November 23, 2015 20:00
-
-
Save michaltakac/92b09b8637b2836d5b04 to your computer and use it in GitHub Desktop.
Meteorboard - page header component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from 'react-pure-render/component'; | |
import React, {PropTypes} from 'react'; | |
import {Col} from 'react-bootstrap'; | |
import {Link} from 'react-router'; | |
export default class PageHeader extends Component { | |
static propTypes = { | |
description: PropTypes.string, | |
menu: PropTypes.object, | |
title: PropTypes.string.isRequired | |
} | |
render() { | |
return ( | |
<Col sm={12}> | |
<div className="page-header"> | |
<div className="clearfix"> | |
<h3 className="content-title pull-left">{this.props.title}</h3> | |
</div> | |
<div className="description">{this.props.description}</div> | |
{this.getmenu()} | |
</div> | |
</Col> | |
); | |
} | |
hasMenu() { | |
return this.props.menu ? true : false; | |
} | |
getmenu() { | |
const menu = this.hasMenu() | |
? <div className='page-header-menu'> | |
<ul> | |
{this.props.menu.map((menu) => | |
<Link to={menu.link}> | |
<li className='page-header-menu-item'>{menu.title}</li> | |
</Link> | |
)} | |
</ul> | |
</div> | |
: ''; | |
return menu; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment