UNPKG

@jannie-shao/components-antd4

Version:
32 lines 1.19 kB
import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { cloneElement } from "../utils"; import { rootPrefix } from "../style/config"; var getClass = { txtSuccess: rootPrefix + "-text-success", txtWarning: rootPrefix + "-text-warning", txtDanger: rootPrefix + "-text-danger", txtPrimary: rootPrefix + "-text-primary", inline: rootPrefix + "-ele-inline", toInput: 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 cloneElement(children, { className: classnames(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.string, children: PropTypes.node }; Styling.defaultProps = { type: '', children: /*#__PURE__*/React.createElement(React.Fragment, null) }; export default Styling;