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

Enhance FilePicker CTA button #325

Open
div-Leo opened this issue Apr 19, 2023 · 3 comments
Open

Enhance FilePicker CTA button #325

div-Leo opened this issue Apr 19, 2023 · 3 comments
Labels
component enhancement New feature or request

Comments

@div-Leo
Copy link
Contributor

div-Leo commented Apr 19, 2023

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 div-Leo added component enhancement New feature or request labels Apr 19, 2023
@nlopin
Copy link
Member

nlopin commented Apr 19, 2023

How do you see this in the API?

@div-Leo
Copy link
Contributor Author

div-Leo commented Apr 19, 2023

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
Copy link
Contributor Author

div-Leo commented Apr 20, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component enhancement New feature or request
Development

No branches or pull requests

2 participants