Sha256: 4c62e2d8f50cb92e514c7eb90abfe1cc9f2476c4aa653bbb484fcc556aee9c39

Contents?: true

Size: 751 Bytes

Versions: 848

Compression:

Stored size: 751 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']}
          onFilesAccepted={handleOnFilesAccepted}
          {...props}
      />
    </div>
  )
}

export default FileUploadAccept

Version data entries

848 entries across 848 versions & 2 rubygems

Version Path
playbook_ui_docs-13.32.0.pre.alpha.PLAY14143271 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143271 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-13.32.0.pre.alpha.PLAY14143267 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143267 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-13.32.0.pre.alpha.PLAY14143264 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143264 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui_docs-13.32.0.pre.alpha.PLAY14143260 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143260 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx