Sha256: 3676668d1dd972e47dcc2b62f048cc29d07a5efb816d7efa0f8aa66fe8d2fa11

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

/* eslint-disable react/no-multi-comp */
/* @flow */

import React, { useState } from "react";
import { FileUpload, List, ListItem } from "playbook-ui";

const AcceptedFilesList = ({ files }) => (
  <List>
    {files.map((file) => (
      <ListItem key={file.name}>{file.name}</ListItem>
    ))}
  </List>
);

const FileUploadCustomDescription = (props) => {
  const [filesToUpload, setFilesToUpload] = useState([]);

  const handleOnFilesAccepted = (files) => {
    setFilesToUpload([...filesToUpload, ...files]);
  };

  return (
    <div>
      <AcceptedFilesList
          files={filesToUpload}
          {...props}
      />
      <FileUpload
          accept={['application/pdf','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']}
          acceptedFilesDescription="Adobe (.pdf) and Microsoft (.xslx)"
          onFilesAccepted={handleOnFilesAccepted}
          {...props}
      />
    </div>
  );
};

export default FileUploadCustomDescription;

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
playbook_ui_docs-13.32.0.pre.alpha.PLAY14143255 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143255 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx
playbook_ui_docs-13.32.0.pre.alpha.PLAY14143251 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143251 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx