wave icon indicating copy to clipboard operation
wave copied to clipboard

Enhance FilePicker CTA button

Open div-Leo opened this issue 2 years ago • 3 comments

Describe the feature you'd like

Allow users to inject a custom component as the CTA button.

ATM we opinionatedly render 2 different CTAs based on desktop/mobile (button for desktop and icon for mobile) The advantage is to have a more flexible implementation so that the user can choose what to show as CTA.

Mobile FilePicker request: Screenshot 2023-04-19 at 09 27 52

Questions:

  • Do we want to add mobile/desktop components?
  • Do we want to add empty/uploaded components?

Describe alternatives you've considered

We could add another condition to choose whether to force to render the icon or the button in the mobile version.

div-Leo avatar Apr 19 '23 07:04 div-Leo

How do you see this in the API?

nlopin avatar Apr 19 '23 08:04 nlopin

To keep it simple I'd add a single component that replaces any state mobile/desktop and empty/uploaded, and it will look something like this:

<FilePicker
  {...}
  ComponentCTA={<TextButton>Add</TextButton>}
/>

The logic for empty/uploaded can be easily reimplemented with the onFileChange callback


<FilePicker
  {...}
  ComponentCTA={selectedFile ? <TextButton>Add</TextButton> : <TextButton>Change</TextButton>}
  onFileChange={(file)=> setSelectedFile(file)}
/>

div-Leo avatar Apr 19 '23 10:04 div-Leo

Sync outcome: we should push back to keep consistency and avoid component injection. Status: stand by

div-Leo avatar Apr 20 '23 09:04 div-Leo

Not relevant anymore

arturmiglio avatar Aug 28 '24 10:08 arturmiglio