PureScript FFI bindings for "react-dropzone" package.
It's work in progress, not published on pursuit yet, but it's working, I have used it in production. For now you can dirty copy-paste it or use as git-submodule.
Keep in mind that this example requires purescript-react-spaces.
dropzone ^^ dropzoneDefaultProps
{ multiple = false
, accept = toNullable $ Just "image/jpeg, image/png"
, onDropAccepted = toNullable $ Just $ handle2 $
\files _ -> case head files of
Nothing -> pure unit
Just x -> onFileDropped x
, onDropRejected = toNullable $ Just $ handle2 $
\files _ -> onFilesRejected files
}
$ do
p $ text "Try dropping some files here, or click to select files to upload."
p $ text "Only *.jpeg and *.png images will be accepted."