Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, {Component} from 'react';
- import { Upload, Icon } from 'antd';
- import message from '../../feedback/message';
- const Dragger = Upload.Dragger;
- class DragUpload extends Component{
- render() {
- const {listAttachments, handleSubmitAttachment} = this.props
- const props = {
- name: 'photo',
- multiple: true,
- listType: 'picture',
- action: handleSubmitAttachment,
- defaultFileList: [...listAttachments],
- onChange(info) {
- const status = info.file.status;
- if (status === 'done') {
- message.success(`${info.file.name} definida como foto de perfil.`);
- } else if (status === 'error') {
- message.error(`${info.file.name} não pôde ser enviado.`);
- }
- },
- }
- return (
- <Dragger {...props}>
- <p className="ant-upload-drag-icon">
- <Icon type="inbox" />
- </p>
- <p className="ant-upload-text">Clique ou arraste arquivos para anexar</p>
- </Dragger>
- )
- }
- }
- export default DragUpload;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement