@atlaskit/avatar
Version:
An avatar is a visual representation of a user or entity.
18 lines (17 loc) • 720 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useEnsureIsInsideAvatar = exports.EnsureIsInsideAvatarContext = void 0;
var _react = require("react");
/**
* Used to ensure Avatar sub-components are used within a Avatar component,
* and provide a useful error message if not.
*/
var EnsureIsInsideAvatarContext = exports.EnsureIsInsideAvatarContext = /*#__PURE__*/(0, _react.createContext)(false);
var useEnsureIsInsideAvatar = exports.useEnsureIsInsideAvatar = function useEnsureIsInsideAvatar() {
var context = (0, _react.useContext)(EnsureIsInsideAvatarContext);
if (!context) {
throw new Error('Avatar sub-components must be used within a Avatar component.');
}
};