overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-preview-pane.js
June Kelly 03e1daa038 Merge pull request #5201 from overleaf/msm-pdf-viewer-error-boundaries
Error boundaries for React PDF viewer

GitOrigin-RevId: 90052fc183f7ece8125ecfb0410a529cf905c13b
2021-10-07 08:03:43 +00:00

32 lines
837 B
JavaScript

import { memo, Suspense } from 'react'
import PdfLogsViewer from './pdf-logs-viewer'
import PdfViewer from './pdf-viewer'
import { usePdfPreviewContext } from '../contexts/pdf-preview-context'
import PdfPreviewToolbar from './pdf-preview-toolbar'
import LoadingSpinner from '../../../shared/components/loading-spinner'
function PdfPreviewPane() {
const { showLogs } = usePdfPreviewContext()
return (
<div className="pdf full-size">
<PdfPreviewToolbar />
<Suspense fallback={<LoadingPreview />}>
<div className="pdf-viewer">
<PdfViewer />
</div>
</Suspense>
{showLogs && <PdfLogsViewer />}
</div>
)
}
function LoadingPreview() {
return (
<div className="pdf-loading-spinner-container">
<LoadingSpinner />
</div>
)
}
export default memo(PdfPreviewPane)