Is it possible to drag and drop directly on UploadButton #530
-
I wanted to see if it was possible to allow dragging and dropping on the
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
hey @jacob-minca simple example with styled-components: const StyledDropZoneWithButton = styled(UploadDropZone)`
&.drag-over {
button {
display: none;
}
}
`;
const WithUploadButtonInside = () => {
return (
<Uploady>
<StyledDropZoneWithButton
onDragOverClassName="drag-over"
>
<UploadButton />
</StyledDropZoneWithButton>
</Uploady>
);
} |
Beta Was this translation helpful? Give feedback.
-
Hey, @yoavniran. Amazing work. Thank you. Hope I'm not incurring on your SciFi writing here with my spam. Ultimate, I would love to have a DropZone which supports Drag or Click, like in React DropZone. Current approach, following your suggestion here, is to include a <Uploady
destination={{ url: upload_url + "&doctype=" + selectedDocType }}
>
<UploadDropZone
className="dropzone"
onDragOverClassName="drag-over"
>
<UploadButton>Drag files or click here to upload.</UploadButton>
<span>Drag files or click here to upload.</span>
</UploadDropZone>
</Uploady> .dropzone {
align-items: center;
padding: 20px;
border-width: 2px;
border-radius: 6px;
margin: 0 2em;
border-color: #898989;
border-style: dashed;
background-color: #fafafa;
color: #898989;
outline: none;
transition: border .24s ease-in-out;
}
.dropzone button {
border: none;
background: none;
color: inherit;
font-size: inherit;
font-family: inherit;
font-weight: inherit;
line-height: inherit;
letter-spacing: inherit;
}
.dropzone.drag-over button {
display: none;
}
.dropzone:not(.drag-over) span {
display: none;
} Would this be the approach you'd recommend? |
Beta Was this translation helpful? Give feedback.
-
hey @MikeiLL Without running your code, I'd say it looks good. 👍 I like to change the drop-zone style a bit when the drag is over it to mark it "ready" for drop, but that's entirely a cosmetic option. |
Beta Was this translation helpful? Give feedback.
-
Nice suggestion! |
Beta Was this translation helpful? Give feedback.
-
thank you for the help @MikeiLL @yoavniran |
Beta Was this translation helpful? Give feedback.
Hey, @yoavniran.
Amazing work. Thank you.
Hope I'm not incurring on your SciFi writing here with my spam.
Ultimate, I would love to have a DropZone which supports Drag or Click, like in React DropZone.
Current approach, following your suggestion here, is to include a
<UploadButton>
and a<span>
, toggling between them ondropzone.drag-over
: