"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

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

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

var _shared = require("choerodon-ui/shared");

var _utils = require("../configure/utils");

var AvatarContext = (0, _shared.getContext)(_shared.Symbols.AvatarContext, {
  getPrefixCls: _utils.getPrefixCls
});

var BaseAvatarContextProvider = function AvatarContextProvider(props) {
  var children = props.children,
      size = props.size,
      getGlobalPrefixCls = props.getPrefixCls;
  var value = (0, _react.useMemo)(function () {
    return {
      size: size,
      getPrefixCls: getGlobalPrefixCls
    };
  }, [getGlobalPrefixCls, size]);
  return /*#__PURE__*/_react["default"].createElement(AvatarContext.Provider, {
    value: value
  }, children);
};

BaseAvatarContextProvider.displayName = 'AvatarContextProvider';
var AvatarContextProvider = /*#__PURE__*/(0, _react.memo)(BaseAvatarContextProvider);
exports.AvatarContextProvider = AvatarContextProvider;
var _default = AvatarContext;
exports["default"] = _default;
//# sourceMappingURL=AvatarContext.js.map
