-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from kleros/refactor/file-size
- Loading branch information
Showing
6 changed files
with
212 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react'; | ||
import PropTypes from "prop-types"; | ||
import Dropzone from 'react-dropzone'; | ||
import { Col } from 'react-bootstrap'; | ||
|
||
import { ReactComponent as UploadSVG } from "../assets/images/upload.svg"; | ||
import { ReactComponent as InfoSVG } from "../assets/images/info.svg"; | ||
import { ReactComponent as ErrorSVG } from "../assets/images/error.svg"; | ||
|
||
import styles from "components/styles/fileUploadDropzone.module.css"; | ||
|
||
class FileUploadDropzone extends React.Component { | ||
render() { | ||
const { uploadError, uploadingToIPFS, fileInput, onDrop } = this.props; | ||
|
||
return ( | ||
<div className={styles.dropzoneDiv}> | ||
<Dropzone onDrop={onDrop}> | ||
{({ getInputProps, getRootProps }) => ( | ||
<section className={styles["dropzone"]}> | ||
<div {...getRootProps()} className={styles["vertical-center"]}> | ||
<input {...getInputProps()} /> | ||
<Col className={styles.uploadContent}> | ||
<UploadSVG /> | ||
<p style={{ fontSize: "14px" }}> | ||
{(fileInput && fileInput.path) || (uploadingToIPFS && "Uploading to IPFS...") || ( | ||
"Drop files here or click to select files (Max size: 4MB)" | ||
)} | ||
</p> | ||
</Col> | ||
</div> | ||
</section> | ||
)} | ||
</Dropzone> | ||
|
||
{uploadError && ( | ||
<p className={styles.dropzoneError}> | ||
<ErrorSVG style={{ width: 16 }} /> | ||
{uploadError} | ||
</p> | ||
)} | ||
|
||
<p className={styles.dropzoneInfo}> | ||
<InfoSVG /> | ||
Additionally, you can add an external file in PDF or add multiple files in a single .zip file. | ||
</p> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
FileUploadDropzone.propTypes = { | ||
uploadError: PropTypes.string, | ||
uploadingToIPFS: PropTypes.bool, | ||
fileInput: PropTypes.object, | ||
onDrop: PropTypes.func.isRequired, | ||
}; | ||
|
||
// Default props (if needed) | ||
FileUploadDropzone.defaultProps = { | ||
uploadError: '', | ||
uploadingToIPFS: false, | ||
fileInput: null, | ||
}; | ||
|
||
export default FileUploadDropzone; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.