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: getInputProps #746

Open
wants to merge 60 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d04eec6
first lets move some stuff
juliusmarminge Apr 5, 2024
3481530
move input props to hook
juliusmarminge Apr 5, 2024
ca176fe
ncieeee
juliusmarminge Apr 6, 2024
db16244
nicee
juliusmarminge Apr 6, 2024
655e27b
[wip] custom component example
juliusmarminge Apr 7, 2024
00d2d84
Merge branch 'main' into input-props
juliusmarminge Apr 13, 2024
2435570
merge
juliusmarminge Apr 13, 2024
abd83c5
init demo
juliusmarminge Apr 13, 2024
ec486df
Merge branch 'main' into input-props
juliusmarminge Apr 13, 2024
c1d8139
gettin somewher
juliusmarminge Apr 13, 2024
7f307cf
nit
juliusmarminge Apr 13, 2024
4dd50a1
refactor useDropzone a bit
juliusmarminge Apr 13, 2024
1649f8c
nice
juliusmarminge Apr 13, 2024
467cc66
null
juliusmarminge Apr 13, 2024
cc8f222
fix solid
juliusmarminge Apr 13, 2024
f4584df
fix svelte
juliusmarminge Apr 13, 2024
160ff6c
minify type output
juliusmarminge Apr 13, 2024
e506f61
minify type output for solid and svelte too
juliusmarminge Apr 13, 2024
c111b41
undefined is more natural here
juliusmarminge Apr 13, 2024
fce1a94
fmt
juliusmarminge Apr 13, 2024
564436d
fix svelte linting
juliusmarminge Apr 13, 2024
366a776
re-export useful helper from shared
juliusmarminge Apr 14, 2024
7d115b8
eh
juliusmarminge Apr 15, 2024
c0c15c4
rhf tests
juliusmarminge Apr 15, 2024
fa3d69b
break out
juliusmarminge Apr 15, 2024
6839f2f
check dirty
juliusmarminge Apr 15, 2024
2176789
skippolling
juliusmarminge Apr 15, 2024
84eab1f
auto mode
juliusmarminge Apr 15, 2024
9567b3a
nice
juliusmarminge Apr 15, 2024
3df628c
simple nav
juliusmarminge Apr 15, 2024
66e0cbf
nice
juliusmarminge Apr 15, 2024
f6c6d3b
rm unused
juliusmarminge Apr 15, 2024
8f9e823
rm log
juliusmarminge Apr 15, 2024
bff3a88
simplify
juliusmarminge Apr 15, 2024
5573faa
nice
juliusmarminge Apr 15, 2024
338c61f
with-novel example
juliusmarminge Apr 16, 2024
f9d13c0
readme
juliusmarminge Apr 16, 2024
b559318
nice
juliusmarminge Apr 16, 2024
fd53c56
rename
juliusmarminge Apr 16, 2024
0f08bc0
fix
juliusmarminge Apr 16, 2024
2f03be4
Merge branch 'main' into input-props
juliusmarminge May 12, 2024
32800eb
fix dupe
juliusmarminge May 12, 2024
7ab2c32
Merge branch 'main' into input-props
juliusmarminge May 12, 2024
6c906dc
fix some types
juliusmarminge May 12, 2024
a9431a7
fix more
juliusmarminge May 12, 2024
88576c8
rm ts-expect-error's
juliusmarminge May 12, 2024
7d18883
fix more types
juliusmarminge May 12, 2024
2aacc64
Merge branch 'main' into input-props
markflorkowski May 24, 2024
bc43e09
Merge branch 'main' into input-props
markflorkowski May 25, 2024
5bf7ea3
Merge branch 'main' into input-props
markflorkowski May 29, 2024
53312d7
chore: migrate vue off of `permittedFileInfo` (#837)
markflorkowski Jun 3, 2024
1caf977
chore: Add redirects to docs nextconfig (#843)
markflorkowski May 31, 2024
e0e4740
Merge branch 'main' into input-props
juliusmarminge Jun 3, 2024
a214d80
rm shared dep from pg
juliusmarminge Jun 3, 2024
0c94c52
Merge branch 'main' into input-props
markflorkowski Jun 24, 2024
35d4782
pnpm i
markflorkowski Jun 24, 2024
7182285
remove duplicate imports
markflorkowski Jun 24, 2024
8c592a6
format
markflorkowski Jun 24, 2024
cdb4c0c
Merge branch 'main' into input-props
juliusmarminge Jun 25, 2024
6d0abe7
Merge branch 'main' into input-props
juliusmarminge Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/src/pages/api/uploadthing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createRouteHandler, createUploadthing } from "uploadthing/next-legacy";

const f = createUploadthing();
const router = {
mockRoute: f(["image"])
.middleware(() => {
throw new Error("This is just a mock route, you cant use it");
return {};
})
.onUploadComplete(() => {}),
};
export default createRouteHandler({
router,
config: { uploadthingSecret: "sk_foo" },
});
18 changes: 17 additions & 1 deletion docs/src/pages/theming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ component match your design in the exact way you want.
```

<UploadButton
endpoint="mockRoute"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having these actually load instead of fetch failing helped reduce some impossible states we had weird paths for just to display in here

__internal_button_disabled
__internal_state="ready"
className="ut-button:bg-red-500 ut-button:ut-readying:bg-red-500/50 dark:ut-allowed-content:text-white mt-4"
Expand All @@ -252,6 +253,7 @@ component match your design in the exact way you want.
/>

<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="readying"
className="ut-button:bg-red-500 ut-button:ut-readying:bg-red-500/50 dark:ut-allowed-content:text-white mt-4"
Expand Down Expand Up @@ -312,6 +314,7 @@ component.
```

<UploadButton
endpoint="mockRoute"
__internal_state="uploading"
__internal_button_disabled
appearance={{
Expand All @@ -327,6 +330,7 @@ component.
/>

<UploadButton
endpoint="mockRoute"
__internal_state="ready"
__internal_button_disabled
appearance={{
Expand Down Expand Up @@ -389,6 +393,7 @@ specific elements of components.
```

<UploadButton
endpoint="mockRoute"
__internal_state="ready"
__internal_button_disabled
className="custom-class dark:ut-allowed-content:text-white"
Expand All @@ -399,6 +404,7 @@ specific elements of components.
/>

<UploadButton
endpoint="mockRoute"
__internal_state="readying"
__internal_button_disabled
className="custom-class dark:ut-allowed-content:text-white"
Expand All @@ -414,6 +420,7 @@ specific elements of components.
/>

<UploadButton
endpoint="mockRoute"
__internal_state="uploading"
__internal_button_disabled
className="custom-class dark:ut-allowed-content:text-white"
Expand Down Expand Up @@ -492,6 +499,7 @@ and will return a string
```

<UploadButton
endpoint="mockRoute"
__internal_state="ready"
__internal_button_disabled
className="dark:ut-allowed-content:text-white"
Expand All @@ -511,6 +519,7 @@ and will return a string
/>

<UploadButton
endpoint="mockRoute"
__internal_state="readying"
__internal_button_disabled
className="dark:ut-allowed-content:text-white"
Expand All @@ -529,6 +538,7 @@ and will return a string
/>

<UploadButton
endpoint="mockRoute"
__internal_state="uploading"
__internal_button_disabled
className="dark:ut-allowed-content:text-white"
Expand Down Expand Up @@ -577,6 +587,7 @@ the component and will return a `CSSProperties` object
```

<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="readying"
appearance={{
Expand All @@ -601,6 +612,7 @@ the component and will return a `CSSProperties` object
/>

<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="ready"
appearance={{
Expand All @@ -625,6 +637,7 @@ the component and will return a `CSSProperties` object
/>

<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="uploading"
appearance={{
Expand Down Expand Up @@ -689,6 +702,7 @@ type UploadDropzoneProps = {

```jsx
<UploadButton
endpoint="mockRoute"
content={{
button({ ready }) {
if (ready) return <div>Upload stuff</div>;
Expand All @@ -705,6 +719,7 @@ type UploadDropzoneProps = {
```

<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="readying"
className="ut-allowed-content:text-zinc-500"
Expand All @@ -723,6 +738,7 @@ type UploadDropzoneProps = {
}} />

<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="ready"
content={{
Expand All @@ -747,9 +763,9 @@ appearance={{
}} />

<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="uploading"
__internal_ready={true}
content={{
button({ ready }) {
if (ready) return <div>Upload stuff</div>;
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/src/app/api/uploadthing/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createRouteHandler } from "uploadthing/next";

import { uploadRouter } from "~/server/uploadthing";

export const runtime = "edge";
// export const runtime = "edge";

export const { GET, POST } = createRouteHandler({
router: uploadRouter,
Expand Down
4 changes: 4 additions & 0 deletions examples/with-tailwindcss/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export default function Home() {
onUploadBegin={() => {
console.log("upload begin");
}}
config={{
appendOnPaste: true,
mode: "manual",
}}
/>
<UploadDropzone
className="ut-label:text-lg ut-allowed-content:ut-uploading:text-red-300 ut-allowed-content:text-white w-full bg-slate-800"
Expand Down
Loading
Loading