Skip to content

Commit

Permalink
move className and style to ant-upload-drag
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo837 committed Nov 28, 2019
1 parent 965bc58 commit 65950e9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 1 addition & 3 deletions components/form/__tests__/__snapshots__/demo.test.js.snap
Expand Up @@ -4151,9 +4151,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
<span
class="ant-form-item-children"
>
<span
class=""
>
<span>
<div
class="ant-upload ant-upload-drag"
/>
Expand Down
21 changes: 14 additions & 7 deletions components/upload/Upload.tsx
Expand Up @@ -282,6 +282,7 @@ class Upload extends React.Component<UploadProps, UploadState> {
type,
disabled,
children,
style,
} = this.props;
const { fileList, dragState } = this.state;

Expand All @@ -298,6 +299,7 @@ class Upload extends React.Component<UploadProps, UploadState> {
};

delete rcUploadProps.className;
delete rcUploadProps.style;

const uploadList = showUploadList ? (
<LocaleReceiver componentName="Upload" defaultLocale={defaultLocale.Upload}>
Expand All @@ -306,19 +308,24 @@ class Upload extends React.Component<UploadProps, UploadState> {
) : null;

if (type === 'drag') {
const dragCls = classNames(prefixCls, {
[`${prefixCls}-drag`]: true,
[`${prefixCls}-drag-uploading`]: fileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: dragState === 'dragover',
[`${prefixCls}-disabled`]: disabled,
});
const dragCls = classNames(
prefixCls,
{
[`${prefixCls}-drag`]: true,
[`${prefixCls}-drag-uploading`]: fileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: dragState === 'dragover',
[`${prefixCls}-disabled`]: disabled,
},
className,
);
return (
<span className={className}>
<span>
<div
className={dragCls}
onDrop={this.onFileDrop}
onDragOver={this.onFileDrop}
onDragLeave={this.onFileDrop}
style={style}
>
<RcUpload {...rcUploadProps} ref={this.saveUpload} className={`${prefixCls}-btn`}>
<div className={`${prefixCls}-drag-container`}>{children}</div>
Expand Down
4 changes: 1 addition & 3 deletions components/upload/__tests__/__snapshots__/demo.test.js.snap
Expand Up @@ -302,9 +302,7 @@ exports[`renders ./components/upload/demo/directory.md correctly 1`] = `
`;

exports[`renders ./components/upload/demo/drag.md correctly 1`] = `
<span
class=""
>
<span>
<div
class="ant-upload ant-upload-drag"
/>
Expand Down

0 comments on commit 65950e9

Please sign in to comment.