2016-09-11 01:36:48 +09:00
|
|
|
import ColumnHeader from './column_header';
|
|
|
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
2016-08-25 00:56:44 +09:00
|
|
|
|
|
|
|
const Column = React.createClass({
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2016-08-25 00:56:44 +09:00
|
|
|
propTypes: {
|
2016-09-11 01:36:48 +09:00
|
|
|
heading: React.PropTypes.string,
|
2016-09-13 09:24:40 +09:00
|
|
|
icon: React.PropTypes.string,
|
|
|
|
fluid: React.PropTypes.bool
|
2016-08-25 00:56:44 +09:00
|
|
|
},
|
|
|
|
|
2016-08-31 23:15:12 +09:00
|
|
|
mixins: [PureRenderMixin],
|
|
|
|
|
2016-09-06 07:44:28 +09:00
|
|
|
handleHeaderClick () {
|
|
|
|
let node = ReactDOM.findDOMNode(this);
|
|
|
|
node.querySelector('.scrollable').scrollTo(0, 0);
|
|
|
|
},
|
|
|
|
|
2016-08-31 23:15:12 +09:00
|
|
|
render () {
|
2016-09-11 01:36:48 +09:00
|
|
|
let header = '';
|
|
|
|
|
|
|
|
if (this.props.heading) {
|
|
|
|
header = <ColumnHeader icon={this.props.icon} type={this.props.heading} onClick={this.handleHeaderClick} />;
|
|
|
|
}
|
|
|
|
|
2016-09-13 09:24:40 +09:00
|
|
|
const style = { width: '350px', flex: '0 0 auto', background: '#282c37', margin: '10px', marginRight: '0', display: 'flex', flexDirection: 'column' };
|
|
|
|
|
|
|
|
if (this.props.fluid) {
|
|
|
|
style.width = 'auto';
|
|
|
|
style.flex = '1 1 auto';
|
|
|
|
style.background = '#21242d';
|
|
|
|
}
|
|
|
|
|
2016-08-25 00:56:44 +09:00
|
|
|
return (
|
2016-09-13 09:24:40 +09:00
|
|
|
<div style={style}>
|
2016-09-11 01:36:48 +09:00
|
|
|
{header}
|
|
|
|
{this.props.children}
|
2016-08-25 00:56:44 +09:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2016-08-25 00:56:44 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
export default Column;
|