mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-11 13:59:11 +08:00
31 lines
862 B
JavaScript
31 lines
862 B
JavaScript
import React, { PropTypes } from 'react';
|
|
import classNames from 'classnames';
|
|
|
|
const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
|
|
|
const Col = React.createClass({
|
|
propTypes: {
|
|
span: stringOrNumber,
|
|
order: stringOrNumber,
|
|
offset: stringOrNumber,
|
|
push: stringOrNumber,
|
|
pull: stringOrNumber,
|
|
className: PropTypes.string,
|
|
children: PropTypes.node,
|
|
},
|
|
render() {
|
|
const { span, order, offset, push, pull, className, ...others } = this.props;
|
|
const classes = classNames({
|
|
[`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>;
|
|
},
|
|
});
|
|
|
|
export default Col;
|