about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/ui/components/column_header.jsx
blob: de55fa7485af9b9aa4b5de3309f6fda4e6454660 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 className={`column-header ${active ? 'active' : ''}`} onClick={this.handleClick}>
        {icon}
        {type}
      </div>
    );
  }

});

export default ColumnHeader;