import * as classNames from "classnames"; import * as React from "react"; import * as _ from "lodash"; import { Badge, IBadgeProps } from "./../Badge"; import { ISpriteProps, Sprite } from "./../Sprite"; import { Upload, IUploadProps } from "./../Upload"; import { Stats, IStatsProps } from "./../Stats"; export enum AvatarSize { Standard = "Standard", Medium = "Medium", Large = "Large", } export interface IAvatarProps { /** * This is a required fallback character that is * rendered if there is no `src` */ character?: string; className?: string; size?: AvatarSize; sprite?: ISpriteProps; style?: React.CSSProperties; src?: string; /** * An outer rim around the avatar. This is in addition to the default * white inner rim. */ rim?: boolean; // @ts-ignore rimColor?: string; badge?: IBadgeProps; editable?: IUploadProps; onClick?: () => void; innerRef?: React.RefObject; expanded?: boolean; name?: string; stats?: IStatsProps; } export const Avatar = ({ rim, rimColor, sprite, src, size, className, style, character, badge, editable, onClick, innerRef, expanded = false, name, stats, }: IAvatarProps) => ( {!_.isEmpty(src) ? : sprite ? : {character} } {(badge || editable) && ( {editable ? : } )}
{name && (
{name}
)} {(stats && !_.isEmpty(stats.stats)) && (
)}
);