1
0
REI-Fixed/app/assets/javascripts/components/features/ui/components/column_header.jsx
JP DeVries 1467515d3d Use landmark regions on columns (#1732)
Closes mastodon#1720
2017-04-14 11:12:59 +02:00

38 lines
787 B
JavaScript

import PureRenderMixin from 'react-addons-pure-render-mixin';
const ColumnHeader = React.createClass({
propTypes: {
icon: React.PropTypes.string,
type: React.PropTypes.string,
active: React.PropTypes.bool,
onClick: React.PropTypes.func
},
mixins: [PureRenderMixin],
handleClick () {
this.props.onClick();
},
render () {
const { type, active } = this.props;
let icon = '';
if (this.props.icon) {
icon = <i className={`fa fa-fw fa-${this.props.icon}`} style={{ display: 'inline-block', marginRight: '5px' }} />;
}
return (
<div aria-label={type} className={`column-header ${active ? 'active' : ''}`} onClick={this.handleClick}>
{icon}
{type}
</div>
);
}
});
export default ColumnHeader;