Skip to content

Commit

Permalink
feat(DownloadFiles): add to the FileActionsHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Oct 26, 2023
1 parent dc952a6 commit a5b6b1f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.container {
text-align: right;
display: flex;
justify-content: end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EditFilesMenu } from './edit-files-menu/EditFilesMenu'
import { File } from '../../../../../files/domain/models/File'
import styles from './FileActionsHeader.module.scss'
import { useTranslation } from 'react-i18next'
import { DownloadFilesButton } from './download-files/DownloadFilesButton'
interface FileActionsHeaderProps {
files: File[]
}
Expand All @@ -10,6 +11,7 @@ export function FileActionsHeader({ files }: FileActionsHeaderProps) {
return (
<div aria-label={t('actions.title')} className={styles.container}>
<EditFilesMenu files={files} />
<DownloadFilesButton files={files} />
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ export function DownloadFilesButton({ files }: DownloadFilesButtonProps) {
id="download-files"
icon={<Download className={styles.icon} />}
title="Download"
variant="secondary">
variant="secondary"
withSpacing>
<DropdownButtonItem>Original Format</DropdownButtonItem>
<DropdownButtonItem>Archival Format (.tab)</DropdownButtonItem>
</DropdownButton>
)
}

return (
<Button variant="secondary" icon={<Download className={styles.icon} />}>
<Button variant="secondary" icon={<Download className={styles.icon} />} withSpacing>
Download
</Button>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('FileActionsHeader', () => {
it('renders the file actions header', () => {
const datasetRepository: DatasetRepository = {} as DatasetRepository
const datasetWithUpdatePermissions = DatasetMother.create({
permissions: DatasetPermissionsMother.createWithUpdateDatasetAllowed(),
permissions: DatasetPermissionsMother.createWithAllAllowed(),
hasValidTermsOfAccess: true
})
datasetRepository.getByPersistentId = cy.stub().resolves(datasetWithUpdatePermissions)
Expand All @@ -25,5 +25,6 @@ describe('FileActionsHeader', () => {
)

cy.findByRole('button', { name: 'Edit Files' }).should('exist')
cy.findByRole('button', { name: 'Download' }).should('exist')
})
})

0 comments on commit a5b6b1f

Please sign in to comment.