Icon.js 559 B

123456789101112131415161718
  1. import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
  2. import * as React from 'react';
  3. export default function Icon(_ref) {
  4. var icon = _ref.icon,
  5. props = _ref.props,
  6. children = _ref.children;
  7. var iconNode;
  8. if (icon === null || icon === false) {
  9. return null;
  10. }
  11. if (typeof icon === 'function') {
  12. iconNode = /*#__PURE__*/React.createElement(icon, _objectSpread({}, props));
  13. } else if (typeof icon !== "boolean") {
  14. // Compatible for origin definition
  15. iconNode = icon;
  16. }
  17. return iconNode || children || null;
  18. }