overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-preview-pane.js
Timothée Alby ac3eb878d6 Merge pull request #7172 from overleaf/ta-pdf-viewer-backdrop-hide
Fix Logo Backdrop in PDF Viewer

GitOrigin-RevId: ae9eb98dc8a51a882354b6ddea095df2bed51346
2022-03-24 09:03:44 +00:00

40 lines
1.1 KiB
JavaScript

import { memo, Suspense } from 'react'
import classNames from 'classnames'
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'
import { useCompileContext } from '../../../shared/context/compile-context'
const newPreviewToolbar = new URLSearchParams(window.location.search).has(
'new_preview_toolbar'
)
function PdfPreviewPane() {
const { pdfUrl } = useCompileContext()
const classes = classNames('pdf', 'full-size', {
'pdf-empty': !pdfUrl,
})
return (
<div className={classes}>
{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)