ant-design/components/skeleton/Avatar.tsx
zombieJ 796b56dbc4
New Component Skeleton (#11226)
* Add new component Skeleton
* Add related doc
* Add sample
* Add test case

ref: https://github.com/ant-design/ant-design/issues/10308
2018-08-22 23:34:36 +08:00

38 lines
929 B
TypeScript

import * as React from 'react';
import classNames from 'classnames';
export interface SkeletonAvatarProps {
prefixCls?: string;
className?: string;
style?: object;
size?: 'large' | 'small' | 'default';
shape?: 'circle'| 'square';
}
class Title extends React.Component<SkeletonAvatarProps, any> {
static defaultProps: Partial<SkeletonAvatarProps> = {
prefixCls: 'ant-skeleton-avatar',
size: 'large',
};
render() {
const { prefixCls, className, style, size, shape } = this.props;
const sizeCls = classNames({
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
});
const shapeCls = classNames({
[`${prefixCls}-circle`]: shape === 'circle',
[`${prefixCls}-square`]: shape === 'square',
});
return (
<span className={classNames(prefixCls, className, sizeCls, shapeCls)} style={style} />
);
}
}
export default Title;