-
Notifications
You must be signed in to change notification settings - Fork 5
Some improvements to the Upload component #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f4f9293
to
7de59a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
43483b2
to
f113b34
Compare
f113b34
to
d679eae
Compare
@kimispencer @spicydonuts I've updated this PR with some feedback from @hdgarrood. Could you review it again, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 (updated the base branch here as well)
src/Lumi/Components/Upload.purs
Outdated
@@ -124,6 +126,8 @@ type UploadProps = | |||
|
|||
type UploadBackend = | |||
{ fetch :: FileId -> Aff FileInfo | |||
-- | Allows for running arbitrary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there suppose to be more to this comment? As is it doesn't seem that useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, thanks for catching that!
This PR contains breaking changes.
Remove theonChange
prop fromUpload
and replace it withonUpload :: Array FileId -> Effect Unit
andonRemove :: FileId -> Maybe (Effect Unit)
.TheMaybe
inonRemove
lets us make some files non-removable.readonly :: Boolean
field toFileInfo
that indicates whether a given file may be removed or not.remove :: FileId -> Aff Boolean
field toUploadBackend
that allows for running an async action to check whether the file should be removed (e.g. a confirmation modal).onClick :: FileId -> Maybe (Effect Unit)
prop toUpload
so that users can interact with the uploaded files — e.g. for downloading them.FormDefaults
instances forSet
andMap
.