choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
42 lines (41 loc) • 1.33 kB
TypeScript
import { Component, CSSProperties, ReactElement } from 'react';
import Group from './Group';
import AvatarContext, { AvatarContextValue } from './AvatarContext';
import { Size } from '../_util/enum';
export interface AvatarProps {
/** Shape of avatar, options:`circle`, `square` */
shape?: 'circle' | 'square';
size?: Size | number;
/** Src of image avatar */
src?: string;
/** Type of the Icon to be used in avatar */
icon?: string;
style?: CSSProperties;
prefixCls?: string;
className?: string;
children?: any;
alt?: string;
onError?: () => boolean;
renderIcon?: (type: string) => ReactElement;
}
export interface AvatarState {
scale: number;
isImgExist: boolean;
}
export default class Avatar extends Component<AvatarProps, AvatarState> {
static displayName: string;
static get contextType(): typeof AvatarContext;
static defaultProps: {
shape: string;
size: Size;
};
static Group: typeof Group;
context: AvatarContextValue;
private avatarChildren;
constructor(props: AvatarProps, context: AvatarContextValue);
componentDidMount(): void;
componentDidUpdate(prevProps: AvatarProps, prevState: AvatarState): void;
setScale: () => void;
handleImgLoadError: () => void;
render(): JSX.Element;
}