Browse Source

feat(Avatar): support draggable prop (#24314)

pull/24320/head
Yu 5 years ago
committed by GitHub
parent
commit
e197163a78
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      components/avatar/index.tsx

12
components/avatar/index.tsx

@ -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;
@ -106,6 +107,7 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
icon,
className,
alt,
draggable,
...others
} = this.props;
@ -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 {

Loading…
Cancel
Save