Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

added dropzone component#335

Open
robsel118 wants to merge 4 commits intoProtonMail:masterfrom
robsel118:dropzone
Open

added dropzone component#335
robsel118 wants to merge 4 commits intoProtonMail:masterfrom
robsel118:dropzone

Conversation

@robsel118
Copy link

#139

I have tried to make a basic dropzone. If I could access the Zeplin mock-up, I could see to change it a bit. When dropping a valid file, the handleDrop callback function is called with the file.

All the children are rendered in a centered column.

Please let me know of any issues and improvements.

Example

    <DropZone
      handleDrop={file => {
        console.log(file);
      }}
      validTypes={[
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        'text/x-vcard'
      ]}
    >
      <h1>DropZone</h1>
      <h1>Drop your file here</h1>
      <input type="file" />
    </DropZone>

@EpokK EpokK self-assigned this Oct 9, 2019
@EpokK EpokK requested review from Yiin, econdepe and vincaslt and removed request for vincaslt October 9, 2019 20:10
@EpokK
Copy link
Contributor

EpokK commented Oct 10, 2019

Hi @robsel118

Thanks a lot for your pull request. Your code looks good but we would like to improve it a bit:

  • modernize the component by using React hook.
  • add more listener than just handleDrop.
  • rename listeners handleDrop => onDrop.
  • use classnames helper.
  • use colors from design-system project.

@robsel118
Copy link
Author

robsel118 commented Oct 19, 2019

Hello @EpokK , sorry for the delay.
I made the changes according your feedback. Please let me know if it is okay.

  <Dropzone
      onDrop={file => console.log(file)}
      onDragEnter={isFileValid => {
        if (isFileValid) {
          console.log('success');
        } else {
          console.log('failure');
        }
      }}
      onDragExit={() => console.log('file was not dropped')}
      validTypes={[
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        'text/x-vcard'
      ]}
    >
      <div>DROP ZONE</div>
    </Dropzone>

@Yiin Yiin requested a review from EpokK October 31, 2019 12:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants