You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.0 KiB

  1. import ColumnHeader from './column_header';
  2. import PureRenderMixin from 'react-addons-pure-render-mixin';
  3. const Column = React.createClass({
  4. propTypes: {
  5. heading: React.PropTypes.string,
  6. icon: React.PropTypes.string,
  7. fluid: React.PropTypes.bool
  8. },
  9. mixins: [PureRenderMixin],
  10. handleHeaderClick () {
  11. let node = ReactDOM.findDOMNode(this);
  12. node.querySelector('.scrollable').scrollTo(0, 0);
  13. },
  14. render () {
  15. let header = '';
  16. if (this.props.heading) {
  17. header = <ColumnHeader icon={this.props.icon} type={this.props.heading} onClick={this.handleHeaderClick} />;
  18. }
  19. const style = { width: '350px', flex: '0 0 auto', background: '#282c37', margin: '10px', marginRight: '0', display: 'flex', flexDirection: 'column' };
  20. if (this.props.fluid) {
  21. style.width = 'auto';
  22. style.flex = '1 1 auto';
  23. style.background = '#21242d';
  24. }
  25. return (
  26. <div style={style}>
  27. {header}
  28. {this.props.children}
  29. </div>
  30. );
  31. }
  32. });
  33. export default Column;