Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
DownloadZipFiles.js 560 B
import React from 'react'
import { Spinner } from '@pubsweet/ui'
import { compose, withState } from 'recompose'
import { Item } from 'pubsweet-component-faraday-ui'

import { withZipDownload } from './helpers'

const DownloadZipFiles = ({ disabled, fetching, children, downloadFiles }) => (
  <Item
    flex={0}
    justify="flex-end"
    mr={1}
    onClick={!disabled ? downloadFiles : null}
  >
    {fetching ? <Spinner /> : children}
  </Item>
)

export default compose(
  withState('fetching', 'setFetching', false),
  withZipDownload,
)(DownloadZipFiles)