Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.

Create a component for submitting images to the backend #15

Open
rj-calvin opened this issue Feb 10, 2021 · 0 comments
Open

Create a component for submitting images to the backend #15

rj-calvin opened this issue Feb 10, 2021 · 0 comments

Comments

@rj-calvin
Copy link
Member

We need to introduce two new form components to our library, FormFileInput and ImageTransform.

FormFileInput will be our React abstraction for <input type="file" /> elements that allow users to select a file from their filesystem for submitting to our backend. Likewise, ImageTransform will be a component that allows an image supplied as a prop to be manipulated/cropped.

Both components should leave most of their interface abstract, making it the responsibility of the caller to handle state involving the files themselves. The caller will supply a callback method to be fired on the onChange event of FormFileInput so that the selected file can be stored in a stateful variable. This update to state can then be used to chain the file into ImageTransform where the cropped image can be stored in a second state variable that can be used when a custom onSubmit callback is fired.

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

No branches or pull requests

1 participant