UNPKG

chowa

Version:

UI component library based on React

42 lines (41 loc) 1.53 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 Divider = (props) => { const { className, style, mode, dashed, title, align } = props; const componentClass = classnames_1.default({ [utils_1.preClass('divider')]: true, [utils_1.preClass(`divider-${mode}`)]: true, [utils_1.preClass('divider-with-title')]: utils_1.isExist(title), [utils_1.preClass('divider-dashed')]: dashed, [utils_1.preClass(`divider-align-${align}`)]: true, [className]: utils_1.isExist(className) }); return (React.createElement("div", { style: style, className: componentClass }, title && React.createElement("span", { className: utils_1.preClass('divider-title') }, title))); }; Divider.propTypes = { className: PropTypes.string, style: PropTypes.object, mode: PropTypes.oneOf(['horizontal', 'vertical']), dashed: PropTypes.bool, title: PropTypes.string, align: PropTypes.oneOf(['center', 'left', 'right', 'top', 'bottom']) }; Divider.defaultProps = { mode: 'horizontal', dashed: false, align: 'center' }; exports.default = Divider;