"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _propTypes = _interopRequireDefault(require("prop-types"));

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var Avatar = function Avatar(_ref) {
  var _classNames;

  var size = _ref.size,
      imageUrl = _ref.imageUrl,
      isEmulating = _ref.isEmulating,
      testSection = _ref.testSection;
  var avatarClassNames = (0, _classnames["default"])('oui-avatar', (_classNames = {}, _defineProperty(_classNames, "oui-avatar--".concat(size), size), _defineProperty(_classNames, 'color-admin--border', isEmulating), _classNames));
  var avatarInlineStyles = imageUrl ? {
    backgroundImage: "url(".concat(imageUrl, ")")
  } : {};
  return _react["default"].createElement("div", {
    "data-test-section": testSection
  }, _react["default"].createElement("div", {
    className: avatarClassNames,
    style: avatarInlineStyles
  }));
};

Avatar.propTypes = {
  /**
   * Image to use for the avatar - default is the anonymous head
   */
  imageUrl: _propTypes["default"].string,

  /**
   * Whether or not the emulating border should appear
   */
  isEmulating: _propTypes["default"].bool,

  /**
   * Size of the avatar, large is default
   */
  size: _propTypes["default"].oneOf(['small', 'medium']),

  /**
   * Data test section to use for testing
   */
  testSection: _propTypes["default"].string
};
var _default = Avatar;
exports["default"] = _default;