import { memo, ReactNode } from 'react' import { Link, LinkProps } from 'react-router-dom' import { FileWordOutlined } from '@ant-design/icons' import { FileInfoDto } from '@api' import { downloadFile } from './factory' import { getLinkToFile } from '@pages/FileDownload' import '@styles/index.css' export type DownloadLinkProps = LinkProps & { file?: FileInfoDto name?: string icon?: ReactNode } export const DownloadLink = memo(({ className = '', file, name, icon = , ...other }) => ( { if (file) downloadFile(file) e.preventDefault() return false }} > {icon} {name ?? file?.name ?? '-'} )) export default DownloadLink