chowa
Version:
UI component library based on React
41 lines (40 loc) • 1.37 kB
JavaScript
/**
* @license chowa v1.1.3
*
* Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn).
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
;
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const PropTypes = require("prop-types");
const classnames_1 = require("classnames");
const utils_1 = require("../utils");
const GridCol = (props) => {
const { children, className, style, span, pull, push, order } = props;
const componentClass = classnames_1.default({
[utils_1.preClass('grid-col')]: true,
[utils_1.preClass(`grid-col-span-${span}`)]: true,
[utils_1.preClass(`grid-col-pull-${pull}`)]: pull > 0,
[utils_1.preClass(`grid-col-push-${push}`)]: push > 0,
[utils_1.preClass(`grid-col-order-${order}`)]: order > 0,
[className]: utils_1.isExist(className)
});
return (React.createElement("div", { style: style, className: componentClass }, children));
};
GridCol.propTypes = {
className: PropTypes.string,
style: PropTypes.object,
span: PropTypes.number.isRequired,
pull: PropTypes.number,
push: PropTypes.number,
order: PropTypes.number
};
GridCol.defaultProps = {
pull: 0,
push: 0,
order: 0
};
exports.default = GridCol;