UNPKG

@coreui/react

Version:

UI Components Library for React.js

33 lines (30 loc) 1.53 kB
import { __rest, __assign } from '../../node_modules/tslib/tslib.es6.js'; import React, { forwardRef } from 'react'; import PropTypes from 'prop-types'; import classNames from '../../_virtual/index.js'; import { textColorsPropType, shapePropType, colorPropType } from '../../props.js'; var CAvatar = 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 = __rest(_a, ["children", "className", "color", "shape", "size", "src", "status", "textColor"]); var statusClassName = status && classNames('avatar-status', "bg-".concat(status)); return (React.createElement("div", __assign({ className: classNames('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: colorPropType, shape: shapePropType, size: PropTypes.string, src: PropTypes.string, status: PropTypes.string, textColor: textColorsPropType, }; CAvatar.displayName = 'CAvatar'; export { CAvatar }; //# sourceMappingURL=CAvatar.js.map