Skip to content

Instantly share code, notes, and snippets.

@yoavniran
Last active July 8, 2020 15:54
Show Gist options
  • Save yoavniran/c8ebe0f0ee796d73062180b0a92f56dd to your computer and use it in GitHub Desktop.
Save yoavniran/c8ebe0f0ee796d73062180b0a92f56dd to your computer and use it in GitHub Desktop.
UploadWithCrop.jsx - react-uploady demo
import Uploady from "@rpldy/uploady";
import UploadButton from "@rpldy/upload-button";
import UploadPreview from "@rpldy/upload-preview";
export default function UploadWithCrop() {
const previewMethodsRef = useRef();
return (
<Uploady
destination={{ url: "[upload-url]" }}
>
<div>
<UploadButton>Upload Files</UploadButton>
<br />
<UploadPreview
PreviewComponent={ItemPreviewWithCrop}
previewComponentProps={{ previewMethods: previewMethodsRef }}
previewMethodsRef={previewMethodsRef}
fallbackUrl="https://icon-library.net/images/image-placeholder-icon/image-placeholder-icon-6.jpg"
/>
</div>
</Uploady>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment