function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import { PisellAvatar } from '@pisell/materials';
import { getAvatarText } from "../../utils";
import { PREFIX } from "../../index";
import "../../index.less";
var Avatar = function Avatar(props) {
  var config = props.config,
    name = props.name,
    cover = props.cover;
  var _ref = config || {},
    useTextAvatar = _ref.useTextAvatar,
    children = _ref.children;
  if (useTextAvatar) {
    var text = children || getAvatarText(name);
    return /*#__PURE__*/React.createElement("div", {
      className: "".concat(PREFIX, "__avatar-wrapper")
    }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
      className: "".concat(PREFIX, "__avatar")
    }, config || {}), text));
  }
  return /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__avatar-wrapper")
  }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
    className: "".concat(PREFIX, "__avatar")
  }, config || {}, {
    src: cover || ''
  })));
};
export default Avatar;