Sha256: e504bb9f6a0d1652a1ee2e1b4a9cd6a20bec46a2b2bd1676927da4dff8108a31

Contents?: true

Size: 794 Bytes

Versions: 38

Compression:

Stored size: 794 Bytes

Contents

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 FileUploadAccept = (props) => {
  const [filesToUpload, setFilesToUpload] = useState([])

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

  return (
    <div>
      <AcceptedFilesList
          files={filesToUpload}
          {...props}
      />
      <FileUpload
          accept={{
            "image/svg+xml": [".svg", ".xml"],
          }}
          onFilesAccepted={handleOnFilesAccepted}
          {...props}
      />
    </div>
  )
}

export default FileUploadAccept

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
playbook_ui-14.11.1 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.11.0.pre.rc.17 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.11.0.pre.rc.17 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.11.0 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.11.0.pre.rc.16 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.11.0.pre.rc.16 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.10.0.pre.alpha.play16825301 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.10.0.pre.alpha.play16825301 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.11.0.pre.rc.15 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.11.0.pre.rc.15 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.11.0.pre.rc.14 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.11.0.pre.rc.14 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.11.0.pre.rc.13 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.11.0.pre.rc.13 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.11.0.pre.rc.12 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.11.0.pre.rc.12 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-14.9.0.pre.alpha.PLAY1660reactdropzone5020 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-14.9.0.pre.alpha.PLAY1660reactdropzone5020 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx