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

32 lines
1,007 B
JavaScript

import PdfCompileButton from './pdf-compile-button'
import PdfDownloadButton from './pdf-download-button'
import PdfLogsButton from './pdf-logs-button'
import PdfExpandButton from './pdf-expand-button'
import { ButtonToolbar } from 'react-bootstrap'
import { memo, useState } from 'react'
import useToolbarBreakpoint from '../hooks/use-toolbar-breakpoint'
const isPreview = new URLSearchParams(window.location.search).get('preview')
function PdfPreviewToolbar() {
const [element, setElement] = useState()
const toolbarClasses = useToolbarBreakpoint(element)
return (
<div ref={element => setElement(element)}>
<ButtonToolbar className={toolbarClasses}>
<div className="toolbar-pdf-left">
<PdfCompileButton />
<PdfDownloadButton />
</div>
<div className="toolbar-pdf-right">
<PdfLogsButton />
{!isPreview && <PdfExpandButton />}
</div>
</ButtonToolbar>
</div>
)
}
export default memo(PdfPreviewToolbar)