2015-10-27 23:52:17 +08:00
|
|
|
import React from 'react';
|
2015-10-28 18:04:56 +08:00
|
|
|
import rcUtil from 'rc-util';
|
2015-10-27 23:52:17 +08:00
|
|
|
|
|
|
|
const Col = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
span: React.PropTypes.string,
|
|
|
|
order: React.PropTypes.string,
|
|
|
|
offset: React.PropTypes.string,
|
|
|
|
push: React.PropTypes.string,
|
|
|
|
pull: React.PropTypes.string,
|
2015-10-28 18:04:56 +08:00
|
|
|
className: React.PropTypes.string,
|
2015-10-27 23:52:17 +08:00
|
|
|
children: React.PropTypes.node,
|
|
|
|
},
|
|
|
|
render() {
|
2015-10-28 18:04:56 +08:00
|
|
|
const {span, order, offset, push, pull, className, ...others} = this.props;
|
|
|
|
const classes = rcUtil.classSet({
|
|
|
|
['col-' + span]: span,
|
|
|
|
['col-order-' + order]: order,
|
|
|
|
['col-offset-' + offset]: offset,
|
|
|
|
['col-push-' + push]: push,
|
|
|
|
['col-pull-' + pull]: pull,
|
|
|
|
[className]: className,
|
|
|
|
});
|
|
|
|
return <div {...others} className={classes}>{ this.props.children }</div>;
|
2015-10-27 23:52:17 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Col;
|