Skip to content

Commit 48bd8a2

Browse files
committed
enable download, remove margin on link if there is no label
1 parent d11a8f8 commit 48bd8a2

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/assets/fontawesome.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { library } from '@fortawesome/fontawesome-svg-core'
22
import {
33
faArrowDown,
44
faArrowUp,
5+
faDownload,
56
faEnvelope,
67
faFileLines,
78
faListCheck,
@@ -19,6 +20,7 @@ import {
1920
library.add(
2021
faArrowDown,
2122
faArrowUp,
23+
faDownload,
2224
faEnvelope,
2325
faFileLines,
2426
faListCheck,

src/components/FilesTable/FilesTable.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
3-
import {
4-
// Button,
5-
Table,
6-
} from 'react-bootstrap'
3+
import { Table } from 'react-bootstrap'
4+
import Link from '../Link/Link'
75
import { allowNull } from '../../resources/utilityFunctions'
86

97
const FilesTable = ({ addClass, files }) => {
@@ -21,17 +19,24 @@ const FilesTable = ({ addClass, files }) => {
2119
<th>Uploaded By</th>
2220
<th>Size</th>
2321
<th>Created At</th>
22+
<th></th>
2423
</tr>
2524
</thead>
2625
<tbody>
2726
{files.map((file) => {
28-
const { uuid, fileName, uploadedBy, contentLength, createdAt } = file
27+
const { contentLength, createdAt, fileName, href, uploadedBy, uuid } = file
2928
return (
3029
<tr key={uuid} className='small'>
3130
<td>{fileName}</td>
3231
<td>{uploadedBy}</td>
3332
<td>{contentLength}</td>
3433
<td>{createdAt}</td>
34+
<td>
35+
<Link
36+
icon='fa-download'
37+
href={href}
38+
/>
39+
</td>
3540
</tr>
3641
)
3742
})}

src/components/Link/Link.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Link = ({ addClass, href, icon, label, style, ...props }) => (
1111
{...props}
1212
>
1313
{icon && (
14-
<FontAwesomeIcon icon={icon} className='me-2 small' />
14+
<FontAwesomeIcon icon={icon} className={`small ${label.length > 0 && 'me-2'}`} />
1515
)}
1616
{label}
1717
</a>

0 commit comments

Comments
 (0)