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

feat: useUploadThingInputProps #729

Closed
1 task done
t3dotgg opened this issue Mar 24, 2024 · 2 comments · May be fixed by #746
Closed
1 task done

feat: useUploadThingInputProps #729

t3dotgg opened this issue Mar 24, 2024 · 2 comments · May be fixed by #746
Labels
✨ enhancement suggestion or feature request to improve uploadthing stale No activity in the past 10 days status: in progress work is currently underway to address this issue

Comments

@t3dotgg
Copy link
Member

t3dotgg commented Mar 24, 2024

Describe the feature you'd like to request

Making custom upload buttons is too hard

Describe the solution you'd like to see

// inferred input off useUploadThing
type Input = Parameters<typeof useUploadThing>;

const useUploadThingInputProps = (...args: Input) => {
  const $ut = useUploadThing(...args);

  const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
    if (!e.target.files) return;

    const selectedFiles = Array.from(e.target.files);
    const result = await $ut.startUpload(selectedFiles);
  };

  return {
    inputProps: {
      handleChange,
      multiple: ($ut.permittedFileInfo?.config?.image?.maxFileCount ?? 1) > 1,
      accept: generateMimeTypes(fileTypes ?? [])?.join(", "),
    },
    isUploading: $ut.isUploading,
  };
};

Can I have this pls <3

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing this feature!
@t3dotgg t3dotgg added the ✨ enhancement suggestion or feature request to improve uploadthing label Mar 24, 2024
@markflorkowski markflorkowski added the status: in progress work is currently underway to address this issue label Apr 10, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had any activity for 10 days. It will be closed in 5 days if no further activity occurs.

@github-actions github-actions bot added the stale No activity in the past 10 days label Oct 15, 2024
Copy link
Contributor

This issue has been closed because it has not had any activity for 5 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement suggestion or feature request to improve uploadthing stale No activity in the past 10 days status: in progress work is currently underway to address this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants