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

feat: implement useReducer for FileUploadContainer state management #105

Merged

Conversation

ndv99
Copy link
Collaborator

@ndv99 ndv99 commented Feb 9, 2024

Done

  • Implemented useReducer to manage FileUploadContainer state more cleanly
  • Changed example to have 2MB file upload limit for easier QA

QA steps

  • Ensure the component is displayed correctly across all breakpoints
  • Ensure the component functions as intended:
    • Upload and display in list
    • Remove from list
    • Display errors on rejected files
    • Rejected files can be removed
    • Dropzone disappears when limit is reached

@webteam-app
Copy link
Collaborator

Demo starting at https://maas-react-components-105.demos.haus

@ndv99
Copy link
Collaborator Author

ndv99 commented Feb 9, 2024

In theory, I could encapsulate the new useReducer logic into a hook, something like useFileUpload - would this be worth it?

Copy link
Contributor

@petermakowski petermakowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done.

src/lib/components/FileUpload/hooks.ts Outdated Show resolved Hide resolved
@ndv99 ndv99 enabled auto-merge (squash) February 20, 2024 14:10
@ndv99 ndv99 force-pushed the implement-userreducer-on-file-upload-container branch from 8ade2a0 to bb2cfc1 Compare February 20, 2024 14:11
@ndv99 ndv99 merged commit 4cc442b into canonical:main Feb 20, 2024
5 checks passed
Copy link

🎉 This PR is included in version 1.24.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants