import { downloadFileWithIframe } from '@ringcentral-integration/utils'; import { RcIconButton, type RcIconButtonProps } from '@ringcentral/juno'; import { Download } from '@ringcentral/juno-icon'; import React, { FC } from 'react'; import { t } from './i18n'; type DownloadButtonProps = { url?: string; name?: string; onClick?: (href?: string) => void; size?: RcIconButtonProps['size']; }; export const DownloadButton: FC = ({ url, name, onClick, size = 'small', }) => { return ( { if (onClick) return onClick(url); e.preventDefault(); e.stopPropagation(); if (!url) return; downloadFileWithIframe(url, name!); }} /> ); };