Skip to content

Commit

Permalink
fix: enable download button if all ticked
Browse files Browse the repository at this point in the history
  • Loading branch information
sripwoud committed Jun 26, 2024
1 parent 43b3a8f commit 110ee66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/web/src/containers/DownloadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { useDownloadUrl, useStore } from '../hooks'

export function DownloadButton() {
const { selectedFile, tickedDownloadAll } = useStore()
const disabled = !(selectedFile || tickedDownloadAll)
const downloadUrl = useDownloadUrl()

const onClick = () => {
window.location.href = downloadUrl
}

return (
<button type='button' onClick={onClick} className='btn btn-primary' disabled={!tickedDownloadAll || !selectedFile}>
<button type='button' onClick={onClick} className='btn btn-primary' disabled={disabled}>
Download
</button>
)
Expand Down

0 comments on commit 110ee66

Please sign in to comment.