Skip to content

Instantly share code, notes, and snippets.

@dunnock
Last active July 11, 2017 19:10
Show Gist options
  • Save dunnock/8b5288d8f5c1d0879800b21ad65b2a43 to your computer and use it in GitHub Desktop.
Save dunnock/8b5288d8f5c1d0879800b21ad65b2a43 to your computer and use it in GitHub Desktop.
Grommet with react-dropzone
.comae-dropzone {
width: auto;
border-width: 0.5em;
border-color: $button-border-color;
border-style: dashed;
border-radius: 2em;
padding: 3.3em;
margin-left: 3em;
margin-right: 3em;
background-color: $drop-background;
font-size: $control-font-size;
text-align: center;
cursor: pointer;
transition: all 0.4s;
&--active {
border-style: solid;
background-color: map-get($brand-status-colors, ok);
transition: all 0.4s;
}
&--reject {
border-style: solid;
background-color: map-get($brand-status-colors, critical);
transition: all 0.4s;
}
};
@media (max-width: 600px) {
.comae-dropzone {
border-width: 0.5em;
border-radius: 2em;
padding: 2em;
margin-left: 1em;
margin-right: 1em;
}
}
import React from 'react';
import Dropzone from 'react-dropzone';
class SnapshotUploader extends React.Component {
onDrop = (acceptedFiles, rejectedFiles) => {
acceptedFiles.forEach(file => console.log(file, 'accepted'));
rejectedFiles.forEach(file => console.log(file, 'rejected'));
}
render() {
return (
<Dropzone
className='comae-dropzone'
activeClassName='comae-dropzone--active'
rejectClassName='comae-dropzone--reject'
onDrop={this.onDrop}
disablePreview
accept={["application/json", "application/x-gzip", "", "application/x-moz-file"]}>
<div>Drop full snapshot or results here</div>
</Dropzone>
)
}
}
export default SnapshotUploader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment