Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed May 12, 2024
1 parent e556991 commit 4e30034
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
16 changes: 16 additions & 0 deletions docs/src/pages/api/uploadthing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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"
__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 @@ -694,6 +707,7 @@ type UploadDropzoneProps = {
```jsx
<UploadButton
endpoint="mockRoute"
content={{
button({ ready }) {
if (ready) return <div>Upload stuff</div>;
Expand All @@ -710,6 +724,7 @@ type UploadDropzoneProps = {
```
<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="readying"
className="ut-allowed-content:text-zinc-500"
Expand All @@ -728,6 +743,7 @@ type UploadDropzoneProps = {
}} />
<UploadButton
endpoint="mockRoute"
__internal_button_disabled
__internal_state="ready"
content={{
Expand All @@ -752,9 +768,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 packages/react/src/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function UploadButton<
});

const styleFieldArg = {
ready: state === "ready",
ready: state !== "readying",
isUploading: state === "uploading",
uploadProgress,
fileTypes,
Expand Down

0 comments on commit 4e30034

Please sign in to comment.