-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
Add FilePicker component #1537
Add FilePicker component #1537
Conversation
Co-authored-by: Jan Potoms <2109932+Janpot@users.noreply.github.com> Signed-off-by: Vytautas Butkus <vytautas.butkus@gmail.com>
Can you also add Also, should we put a bit of effort in making this look a bit better? It feels a bit out of placed compared to the MUI components. Perhaps start by making a benchmark of Material Design (visually) compatible Filepicker components that have been created in the wild? |
@Janpot helper text added
Part of this PR - I don't think so. I don't see this being a blocker for the functionality. It does however inherit props from -edit: alternatively I could try to use a |
Can you define exactly what you want to see? I had a default file input behaviour implemented which was just changed to the button, it did show file name out of the box, it also shown if multiple files were selected. At this point it's not really clear how it should look like. |
Is it possible to make it look just like the native file input, but with an MUI Button (that has an icon for extra visual feedback)? |
Of course it's possible, my question is just, what's the value in current stage of "over optimising" this component so much? If we want default behaviour then why not stick with previous implementation of textfield? |
Yes. If you're willing to get started with it, it'd be great. We can incorporate it into MUI X later. We have an issue on our repository. And we had a couple of requests for a FilePicker/ Dropzone component in the 2022 survey. |
I don't think we're over optimizing here, any PR comment can be dismissed by using the term "over optimizing". The idea was to visually tie in this component with the rest of the components, ideally without sacrificing too much functionality. I feel like a visual feedback of whether and which files are selected is an essential feature of this component. @joserodolfofreitas Thanks, I completely missed that ticket. Been searching on "File input" and "File picker" and "Filepicker" but it doesn't seem to appear on the first few pages. (Makes me think we could introduce a keywords section in the issue template, but that's besides the question). We'll create a basic implementation of a FileInput for toolpad, and we can promote to X when there's more demand. |
And I think differently. I already had a version done which shows by default file name that's selected and uses default MUI TextField styles. I can revert changes to that or keep this implementation that uses Button style. What matters is that actual file pick/upload works, and without an actual design or benchmark I don't see the point in optimising this without any external feedback. This can be further improved/optimised if you (or we as entire team) see the benefit.
Any PR that CAN be dismissed by any reasonable argument should be dismissed, this way we can save time and focus on things that matter and that have positive impact. So in order to stop bikeshedding - which of the 2 options you want me to keep? |
There are two different concerns in tension here:
Personally I think both of these concerns are valid and aren't necessarily "bikeshedding", But I understand that this would be some extra work, so if I really had to choose, I'd say to use the default file input. It has the better UX for the user, and is easier to improve for us afterwards. Before we merge, if you're up for it, I'd propose to add a basic test, like we have for all the other components. |
This is how the 1st option looked like pretty much: https://codesandbox.io/s/red-water-uqq1po?file=/demo.tsx So saying that "it does not adhere to single visual language" is a bit of exaggeration, don't you think? While I agree it can be further OPTIMISED by getting rid of default browser button, I don't see value at this point as per comments explained before - there is no design (which means its likely going to change anyway) and we haven't done any benchmark (which means its likely to change anyway).
Sure I will try to add tests only if playwright allows working with file inputs 🤔 |
👍 Ok, I see now where our misunderstanding originates from. For me, having a browser native button nested inside of a material design textfield would be the definition of "it does not adhere to single visual language". But I understand that the threshold is interpreted differently by different people. |
This reverts commit b2daeef.
reverted to textfield version and added test, please review |
There's one thought I had which may be a bit of a nit, but is related to updating this to a proper FilePicker component in the future. I can imagine that new component won't have MUI |
Props removed |
CleanShot.2023-01-10.at.13.55.02.mp4