overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-clear-cache-button.js
Alf Eaton 73bc3418a2 Add React version of the PDF preview pane (#5135)
GitOrigin-RevId: fcc88a362c3e97c9fddf85d47c3a83a0a0b89432
2021-10-01 08:03:12 +00:00

27 lines
773 B
JavaScript

import Icon from '../../../shared/components/icon'
import { Button } from 'react-bootstrap'
import { usePdfPreviewContext } from '../contexts/pdf-preview-context'
import { useTranslation } from 'react-i18next'
import { memo } from 'react'
function PdfClearCacheButton() {
const { compiling, clearCache, clearingCache } = usePdfPreviewContext()
const { t } = useTranslation()
return (
<Button
bsSize="small"
bsStyle="danger"
className="logs-pane-actions-clear-cache"
onClick={clearCache}
disabled={clearingCache || compiling}
>
{clearingCache ? <Icon type="refresh" spin /> : <Icon type="trash-o" />}
&nbsp;
<span>{t('clear_cached_files')}</span>
</Button>
)
}
export default memo(PdfClearCacheButton)