1.0.9 • Published 1 year ago

cloudscape-file-uploader v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Cloudscape File Uploader

⚠️ THIS PACKAGE IS DEPRECATED. PLEASE USE THE OFFICIAL COMPONENT. ⚠️

NPM version Build Codecov

A file uploader for Cloudscape following: https://cloudscape.design/components/fileupload/

Screenshot of multiple file uploader

Usage

Install the package and Cloudscape peer dependencies with npm:

npm install @cloudscape-design/components @cloudscape-design/design-tokens
npm install cloudscape-file-uploader

...or with Yarn

yarn add @cloudscape-design/components @cloudscape-design/design-tokens
yarn add cloudscape-file-uploader

Add FileUploader to project:

import React, { useState } from "react";
import { FileUploader } from "cloudscape-file-uploader";

function App() {
  const [files, setFiles] = useState([]);
  const [errorText, setErrorText] = useState("");

  return (
    <FileUploader
      fileInputId="singleFileUpload"
      text="Choose a file to upload"
      label="Upload a file"
      errorText={errorText}
      files={files}
      onFilesUploaded={(uploadedFiles) => {
        if (uploadedFiles.length === 1) {
          setFiles1([...uploadedFiles]);
          setErrorText("");
        } else {
          setErrorText("An error occured.");
        }
      }}
    />
  );
}

See more examples.

Development

Install packages and build dist:

yarn install
yarn build

Testing

Test with:

yarn test

Fix prettier with:

npx prettier --write .

Fix eslint with:

npx eslint --fix .
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago