Sha256: 21d9f57fc03c1434f6e4c5b157582c4b4d85d7d49973eba89b46616d52b0892b

Contents?: true

Size: 728 Bytes

Versions: 4

Compression:

Stored size: 728 Bytes

Contents

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

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

  return (
    <div>
      <AcceptedFilesList
          files={filesToUpload}
          {...props}
      />
      <FileUpload
          onFilesAccepted={handleOnFilesAccepted}
          {...props}
      />
    </div>
  )
}

export default FileUploadDefault

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_default.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143255 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.jsx
playbook_ui_docs-13.32.0.pre.alpha.PLAY14143251 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.jsx
playbook_ui-13.32.0.pre.alpha.PLAY14143251 app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.jsx