Skip to content
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

Allow Upload showUploadList to support callbacks #26682

Closed
1 task done
mwaddell opened this issue Sep 10, 2020 · 3 comments
Closed
1 task done

Allow Upload showUploadList to support callbacks #26682

mwaddell opened this issue Sep 10, 2020 · 3 comments

Comments

@mwaddell
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Currently, the showUploadList's removeIcon and downloadIcon properties only support passing in a single ReactNode that represents the same icon used for every item. However, there are commonly situations where certain items on a list cannot be deleted. Currently there is no way for the end user to know whether an item can be removed without first clicking the remove button and receiving an error at that time. If, instead, these could be callbacks of the form (file: File) => ReactNode, then these icons can be selectively changed or hidden as appropriate for each item. This will provide a much better user experience by clearly indicating which items are "removable" or "downloadable" without having to just try each one.

What does the proposed API look like?

The showUploadList property of the component will change from:

boolean | { showPreviewIcon?: boolean, showDownloadIcon?: boolean, showRemoveIcon?: boolean, removeIcon?: React.ReactNode, downloadIcon?: React.ReactNode }

to:

boolean | { showPreviewIcon?: boolean, showDownloadIcon?: boolean, showRemoveIcon?: boolean, removeIcon?: React.ReactNode | (file: File) => React.ReactNode, downloadIcon?: React.ReactNode | (file: File) => React.ReactNode }

@mwaddell
Copy link
Contributor Author

This is an extension to PR #21363

@mwaddell
Copy link
Contributor Author

This issue is resolved by PR #26684

@afc163
Copy link
Member

afc163 commented Sep 13, 2020

Then you can close it.

@afc163 afc163 closed this as completed Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants