UNPKG

chowa

Version:

UI component library based on React

38 lines (37 loc) 1.35 kB
/** * @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. */ "use strict"; 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 ButtonGroup = ({ children, round, mode, justified, className, style }) => { const componentClass = classnames_1.default({ [utils_1.preClass('btn-group')]: true, [utils_1.preClass(`btn-group-${mode}`)]: true, [utils_1.preClass('btn-group-justified')]: mode === 'horizontal' && justified, [utils_1.preClass('btn-group-round')]: mode === 'horizontal' && round, [className]: utils_1.isExist(className) }); return (React.createElement("div", { style: style, className: componentClass }, children)); }; ButtonGroup.propTypes = { className: PropTypes.string, style: PropTypes.object, round: PropTypes.bool, mode: PropTypes.oneOf(['horizontal', 'vertical']), justified: PropTypes.bool }; ButtonGroup.defaultProps = { round: false, mode: 'horizontal', justified: false }; exports.default = ButtonGroup;