import React, { useRef, useState, useCallback } from 'react'; import useIsFocused from './hooks/useIsFocused'; import usePdfDocument from './hooks/usePdfDocument'; import VerticalPages from './VerticalPages'; import ZoomControls from './ui/ZoomControls'; import { DownloadButton, PrintButton } from './ui/IconButtons'; require('./miniViewer.css'); export interface MiniViewerAppProps { pdfPath: string; isDarkTheme: boolean; anchorPage: number; pdfId: string; } export default function MiniViewerApp(props: MiniViewerAppProps) { const pdfDocument = usePdfDocument(props.pdfPath); const isFocused = useIsFocused(); const [zoom, setZoom] = useState(1); const containerEl = useRef(null); const [activePage, setActivePage] = useState(1); const onActivePageChange = useCallback((page: number) => { setActivePage(page); }, []); if (!pdfDocument) { return (
Loading pdf..
); } return (
{activePage}/{pdfDocument.pageCount} pages
{isFocused ? '' : 'Click to enable scroll'}
); }