mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
e26d47cb41
GitOrigin-RevId: 6266028091229c819aee3c8d4bd3bff2e2417125
36 lines
945 B
JavaScript
36 lines
945 B
JavaScript
import { useTranslation } from 'react-i18next'
|
|
import { Button, OverlayTrigger, Tooltip } from 'react-bootstrap'
|
|
import Icon from '../../../shared/components/icon'
|
|
import { usePdfPreviewContext } from '../contexts/pdf-preview-context'
|
|
import { memo } from 'react'
|
|
|
|
function PdfHybridDownloadButton() {
|
|
const { pdfDownloadUrl } = usePdfPreviewContext()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<OverlayTrigger
|
|
placement="bottom"
|
|
overlay={
|
|
<Tooltip id="tooltip-logs-toggle">
|
|
{pdfDownloadUrl
|
|
? t('download_pdf')
|
|
: t('please_compile_pdf_before_download')}
|
|
</Tooltip>
|
|
}
|
|
>
|
|
<Button
|
|
bsStyle="link"
|
|
disabled={!pdfDownloadUrl}
|
|
download
|
|
href={pdfDownloadUrl || '#'}
|
|
target="_blank"
|
|
>
|
|
<Icon type="download" modifier="fw" />
|
|
</Button>
|
|
</OverlayTrigger>
|
|
)
|
|
}
|
|
|
|
export default memo(PdfHybridDownloadButton)
|