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
| import React, { Component, PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames';
export default class Col extends (PureComponent || Component) { static propTypes = { span: PropTypes.number, offset: PropTypes.number, className: PropTypes.string, prefix: PropTypes.string };
static defaultProps = { prefix: 'zent' };
render() { const { span, offset, className, prefix, ...others } = this.props; const classes = cx({ [`${prefix}-col`]: true, [`${prefix}-col-${span}`]: span, [`${prefix}-col-offset-${offset}`]: offset, [className]: className });
return ( <div {...others} className={classes}> {this.props.children} </div> ); } }
|