UNPKG

@coreui/react

Version:

UI Components Library for React.js

35 lines (31 loc) 1.54 kB
'use strict'; var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js'); var React = require('react'); var PropTypes = require('prop-types'); var index = require('../../_virtual/index.js'); var props = require('../../props.js'); var CAvatar = React.forwardRef(function (_a, ref) { var _b; var children = _a.children, className = _a.className, color = _a.color, shape = _a.shape, size = _a.size, src = _a.src, status = _a.status, textColor = _a.textColor, rest = tslib_es6.__rest(_a, ["children", "className", "color", "shape", "size", "src", "status", "textColor"]); var statusClassName = status && index.default('avatar-status', "bg-".concat(status)); return (React.createElement("div", tslib_es6.__assign({ className: index.default('avatar', (_b = {}, _b["bg-".concat(color)] = color, _b["avatar-".concat(size)] = size, _b["text-".concat(textColor)] = textColor, _b), shape, className) }, rest, { ref: ref }), src ? React.createElement("img", { src: src, className: "avatar-img" }) : children, status && React.createElement("span", { className: statusClassName }))); }); CAvatar.propTypes = { children: PropTypes.node, className: PropTypes.string, color: props.colorPropType, shape: props.shapePropType, size: PropTypes.string, src: PropTypes.string, status: PropTypes.string, textColor: props.textColorsPropType, }; CAvatar.displayName = 'CAvatar'; exports.CAvatar = CAvatar; //# sourceMappingURL=CAvatar.js.map