Добавлен компонент ссылки на файл

This commit is contained in:
Александр Сироткин 2022-02-22 15:27:30 +05:00
parent a95df07ac1
commit 081df563b2

View File

@ -0,0 +1,22 @@
import { memo } from 'react'
import { Button, ButtonProps } from 'antd'
import { FileWordOutlined } from '@ant-design/icons'
import { FileInfoDto } from '@api'
import { downloadFile } from './factory'
export type DownloadLinkProps = ButtonProps & {
file?: FileInfoDto
name?: string
}
export const DownloadLink = memo<DownloadLinkProps>(({ file, name, ...other }) => (
<Button
type={'link'}
icon={<FileWordOutlined />}
onClick={file && (() => downloadFile(file))}
{...other}
>{name ?? file?.name ?? '-'}</Button>
))
export default DownloadLink