diff --git a/documentation-site/examples/file-uploader-beta/basic.tsx b/documentation-site/examples/file-uploader-beta/basic.tsx index 46987a3dc5..4cfebdf28b 100644 --- a/documentation-site/examples/file-uploader-beta/basic.tsx +++ b/documentation-site/examples/file-uploader-beta/basic.tsx @@ -31,8 +31,6 @@ export default function Example() { return ( diff --git a/documentation-site/examples/file-uploader-beta/upload-restrictions.tsx b/documentation-site/examples/file-uploader-beta/upload-restrictions.tsx new file mode 100644 index 0000000000..77652a7858 --- /dev/null +++ b/documentation-site/examples/file-uploader-beta/upload-restrictions.tsx @@ -0,0 +1,39 @@ +import * as React from "react"; +import { FileUploaderBeta, type FileRow } from "baseui/file-uploader-beta"; + +export default function Example() { + const [fileRows, setFileRows] = React.useState>([]); + + const processFileOnDrop = ( + file: File, + ): Promise<{ errorMessage: string | null; fileInfo?: any }> => { + return new Promise((resolve) => { + // Fake an upload process for 2 seconds + // For a real-world scenario, replace this with application upload logic + setTimeout(() => { + let fileInfo = { + file, + objectID: "1234", + uploadID: "1234", + uploadStatus: "error", + }; + resolve({ errorMessage: "Custom user error", fileInfo }); + }, 2000); + }); + }; + + return ( + + ); +} diff --git a/documentation-site/pages/components/file-uploader-beta.mdx b/documentation-site/pages/components/file-uploader-beta.mdx index 15e520f7f7..c69a9ae76e 100644 --- a/documentation-site/pages/components/file-uploader-beta.mdx +++ b/documentation-site/pages/components/file-uploader-beta.mdx @@ -3,6 +3,7 @@ import Layout from "../../components/layout"; import Exports from "../../components/exports"; import FileUploaderBetaBasic from "examples/file-uploader-beta/basic.tsx"; +import FileUploaderBetaUploadRestrictions from "examples/file-uploader-beta/upload-restrictions.tsx"; import * as FileUploaderBetaExports from "baseui/file-uploader-beta"; @@ -44,6 +45,13 @@ To learn more, read the corresponding [OWASP article on file uploads](https://ww + + + +