overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-preview-pane.js
Alf Eaton f7ef2532e0 Handle PDF preview on toggle between split and full-width views (#5470)
* Only hide the compile logs pane when toggled off
* Handle PDF preview on toggle between split and full-width views

GitOrigin-RevId: 9ceca8a06a22abfa78f245e1ae5d24af98215906
2021-10-18 08:03:26 +00:00

34 lines
926 B
JavaScript

import { memo, Suspense } from 'react'
import PdfLogsViewer from './pdf-logs-viewer'
import PdfViewer from './pdf-viewer'
import LoadingSpinner from '../../../shared/components/loading-spinner'
import PdfHybridPreviewToolbar from './pdf-preview-hybrid-toolbar'
import PdfPreviewToolbar from './pdf-preview-toolbar'
const newPreviewToolbar = new URLSearchParams(window.location.search).has(
'new_preview_toolbar'
)
function PdfPreviewPane() {
return (
<div className="pdf full-size">
{newPreviewToolbar ? <PdfPreviewToolbar /> : <PdfHybridPreviewToolbar />}
<Suspense fallback={<LoadingPreview />}>
<div className="pdf-viewer">
<PdfViewer />
</div>
</Suspense>
<PdfLogsViewer />
</div>
)
}
function LoadingPreview() {
return (
<div className="pdf-loading-spinner-container">
<LoadingSpinner />
</div>
)
}
export default memo(PdfPreviewPane)