UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

38 lines (32 loc) 1.8 kB
import _extends from "@babel/runtime/helpers/extends"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["prefixCls", "type", "orientation", "className", "children", "dashed"]; import React, { memo, useContext } from 'react'; import classNames from 'classnames'; import ConfigContext from '../config-provider/ConfigContext'; var Divider = function Divider(_ref) { var _classNames; var customizePrefixCls = _ref.prefixCls, _ref$type = _ref.type, type = _ref$type === void 0 ? 'horizontal' : _ref$type, _ref$orientation = _ref.orientation, orientation = _ref$orientation === void 0 ? '' : _ref$orientation, className = _ref.className, children = _ref.children, dashed = _ref.dashed, restProps = _objectWithoutProperties(_ref, _excluded); var _useContext = useContext(ConfigContext), getPrefixCls = _useContext.getPrefixCls; var prefixCls = getPrefixCls('divider', customizePrefixCls); var orientationPrefix = orientation.length > 0 ? "-".concat(orientation) : orientation; var classString = classNames(className, prefixCls, "".concat(prefixCls, "-").concat(type), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-with-text").concat(orientationPrefix), children), _defineProperty(_classNames, "".concat(prefixCls, "-dashed"), !!dashed), _classNames)); return /*#__PURE__*/React.createElement("div", _extends({ className: classString }, restProps), children && /*#__PURE__*/React.createElement("span", { className: "".concat(prefixCls, "-inner-text") }, children)); }; Divider.displayName = 'Divider'; export default /*#__PURE__*/memo(Divider); //# sourceMappingURL=index.js.map