gdq-archive/frontend/components/DownloadButton.tsx

28 lines
742 B
TypeScript
Raw Normal View History

2021-01-03 17:43:50 +00:00
import { IconProp } from '@fortawesome/fontawesome-svg-core';
2020-08-22 20:25:57 +00:00
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React from 'react';
import { Button } from 'react-bootstrap';
import { getDownloadURL } from 'util/api';
import { FormattedMessage } from './localization';
2021-01-03 17:43:50 +00:00
export default function DownloadButton({
icon = 'download',
id,
fileName,
}: {
icon?: IconProp,
id: string,
fileName: string
}) {
2020-08-22 20:25:57 +00:00
return (
<Button variant="success" href={getDownloadURL(id, fileName)}>
2021-01-03 17:43:50 +00:00
<FontAwesomeIcon icon={icon} className="mr-2" />
2020-08-22 20:25:57 +00:00
<FormattedMessage
id="DownloadButton.download"
defaultMessage="Download"
description="Text of the download button"
/>
</Button>
);
}