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)