Sha256: 7d0e6f4b6dc4e1832b2075a1412839975377b6710ae23737b9e289968c474399
Contents?: true
Size: 1017 Bytes
Versions: 38
Compression:
Stored size: 1017 Bytes
Contents
/* eslint-disable react/no-multi-comp */ 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": [".pdf"], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"], }} acceptedFilesDescription="Adobe (.pdf) and Microsoft (.xslx)" onFilesAccepted={handleOnFilesAccepted} {...props} /> </div> ); }; export default FileUploadCustomDescription;
Version data entries
38 entries across 38 versions & 2 rubygems