import { memo, ReactNode } from 'react' import { Link, LinkProps } from 'react-router-dom' import { FileWordOutlined } from '@ant-design/icons' import { FileInfoDto, WellDto } 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 well?: WellDto } export const DownloadLink = memo(({ className = '', file, name, icon = , well, ...other }) => ( { if (file) downloadFile(file, well) e.preventDefault() return false }} > {icon} {name ?? file?.name ?? '-'} )) export default DownloadLink