Skip to content

Commit

Permalink
feat(Avatar): support draggable prop (ant-design#24314)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyu1818 authored May 20, 2020
1 parent a7b81d5 commit e197163
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface AvatarProps {
src?: string;
/** Srcset of image avatar */
srcSet?: string;
draggable?: boolean;
/** icon to be used in avatar */
icon?: React.ReactNode;
style?: React.CSSProperties;
Expand Down Expand Up @@ -106,6 +107,7 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
icon,
className,
alt,
draggable,
...others
} = this.props;

Expand Down Expand Up @@ -142,7 +144,15 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {

let { children } = this.props;
if (src && isImgExist) {
children = <img src={src} srcSet={srcSet} onError={this.handleImgLoadError} alt={alt} />;
children = (
<img
src={src}
draggable={draggable}
srcSet={srcSet}
onError={this.handleImgLoadError}
alt={alt}
/>
);
} else if (icon) {
children = icon;
} else {
Expand Down

0 comments on commit e197163

Please sign in to comment.