Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, {Component} from 'react';
  2. import { Upload, Icon } from 'antd';
  3. import message from '../../feedback/message';
  4. const Dragger = Upload.Dragger;
  5.  
  6. class DragUpload extends Component{
  7.   render() {
  8.     const {listAttachments, handleSubmitAttachment} = this.props
  9.     const props = {
  10.       name: 'photo',
  11.       multiple: true,
  12.       listType: 'picture',
  13.       action: handleSubmitAttachment,
  14.       defaultFileList: [...listAttachments],
  15.       onChange(info) {
  16.         const status = info.file.status;
  17.         if (status === 'done') {
  18.           message.success(`${info.file.name} definida como foto de perfil.`);
  19.         } else if (status === 'error') {
  20.           message.error(`${info.file.name} não pôde ser enviado.`);
  21.         }
  22.       },
  23.     }
  24.     return (
  25.       <Dragger {...props}>
  26.         <p className="ant-upload-drag-icon">
  27.         <Icon type="inbox" />
  28.         </p>
  29.         <p className="ant-upload-text">Clique ou arraste arquivos para anexar</p>
  30.       </Dragger>
  31.     )
  32.   }
  33. }
  34.  
  35. export default DragUpload;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement