UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

40 lines (39 loc) 1.28 kB
import { Component, CSSProperties, ReactElement } from 'react'; import { Size } from '../_util/enum'; import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext'; 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 ConfigContext; static defaultProps: { shape: string; size: Size; }; context: ConfigContextValue; private avatarChildren; constructor(props: AvatarProps, context: ConfigContextValue); componentDidMount(): void; componentDidUpdate(prevProps: AvatarProps, prevState: AvatarState): void; setScale: () => void; handleImgLoadError: () => void; render(): JSX.Element; }