@jannie-shao/components-antd4
Version:
38 lines (37 loc) • 1.58 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _utils = require("../utils");
var _config = require("../style/config");
var getClass = {
txtSuccess: _config.rootPrefix + "-text-success",
txtWarning: _config.rootPrefix + "-text-warning",
txtDanger: _config.rootPrefix + "-text-danger",
txtPrimary: _config.rootPrefix + "-text-primary",
inline: _config.rootPrefix + "-ele-inline",
toInput: _config.rootPrefix + "-ele-to-input-style"
};
var Styling = function Styling(_ref) {
var _children$props;
var type = _ref.type,
children = _ref.children,
_ref$className = _ref.className,
className = _ref$className === void 0 ? '' : _ref$className;
return (0, _utils.cloneElement)(children, {
className: (0, _classnames["default"])(_config.rootPrefix + "-styling", getClass[type] || '', className, (children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.className) || '')
});
};
Styling.propTypes = {
type: _propTypes["default"].string,
children: _propTypes["default"].node
};
Styling.defaultProps = {
type: '',
children: /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null)
};
var _default = Styling;
exports["default"] = _default;