"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const components_1 = require("@bluebase/components");
const Avatar_1 = tslib_1.__importDefault(require("@material-ui/core/Avatar"));
const react_1 = tslib_1.__importDefault(require("react"));
const styles_1 = require("./styles");
const withPropsStyles_1 = require("../../withPropsStyles");
exports.Avatar = withPropsStyles_1.withPropsStyles(styles_1.styles)((props) => {
    const _a = props, { type, icon, size, image, text, bluebaseTheme } = _a, rest = tslib_1.__rest(_a, ["type", "icon", "size", "image", "text", "bluebaseTheme"]);
    const style = props.style;
    const color = props.color || bluebaseTheme.palette.background.default;
    if (type === 'icon') {
        return (react_1.default.createElement(Avatar_1.default, Object.assign({}, rest, { style: style }),
            react_1.default.createElement(components_1.Icon, { name: icon, color: color, size: size && size * 0.6 })));
    }
    if (type === 'image') {
        return (react_1.default.createElement(Avatar_1.default, Object.assign({}, rest, { style: style }),
            react_1.default.createElement(components_1.BlueBaseImage, { source: image, style: [{ height: size, width: size }, style] })));
    }
    return (react_1.default.createElement(Avatar_1.default, Object.assign({}, rest, { style: Object.assign(Object.assign({}, style), { color }) }), text));
});
exports.Avatar.defaultProps = components_1.AvatarDefaultProps;
