Closed dlockhart closed 7 years ago
Maybe rename to d2l-file-input
before making the major bump?
I can... I'm just not sure we want to anymore or what to actually call it.
Hmmm... I think if this thing doesn't actually do the upload, then we shouldn't call it this.
Just spit-balling here: but I am sort of imagining a couple of things here.
d2l-file-input
- the visual component that just gets the file objects
perhaps d2l-file-upload-behavior
- JS that handles the XHR upload to some end-point, passes back progress info (as per XHR's progress event), passes back handle that can be used by consuming code to abort.
perhaps d2l-file-upload
or d2l-file-upload-status
- a WC that interacts with d2l-file-upload-behavior
and shows name of file, progress, and an [x] button to abort. One of these per file.
The part that's not super clear to me is - if the upload operation fails for some reason (ex. restricted file type, file too big, duplicate file name, network error, etc), how does this info get communicated back to d2l-file-uploader
so it can update the message. In some ways, baking all of the above into d2l-file-uploader
avoids putting too much thought into the API between such components (but I think the separation makes sense).
In the back of my mind I've been thinking about how we will update MVC file-input control to use this. I'm not sure if anyone has thought about how these things will hang together...
Can we move this discussion into the issue? #19
For sure. :)
The design calls for different types of feedback to displayed to the user -- errors and warnings. So this change removes the
error
boolean attribute and replaces it withfeedback
(string
) andfeedback-type
("error" or "warning") attributes.This is a breaking change, so when I release it I'll make a major version number increase.
Also worth noting how you can use CSS attribute values to apply CSS to various elements. In this case, I'm using the presence of the
feedback
attribute to hide & show the message<div>
, and the value fromfeedback-type
to control the colour of the message.