@@ -11,7 +11,7 @@ import type {PDFDocument, PageViewport, RotationDegrees} from './types.js';
1111import { pdfPreviewerStyles as styles } from './styles.js' ;
1212import PDFPasswordForm , { type PDFPasswordFormProps } from './PDFPasswordForm.js' ;
1313import PageRenderer from './PageRenderer.js' ;
14- import { PAGE_BORDER , LARGE_SCREEN_SIDE_SPACING , DEFAULT_DOCUMENT_OPTIONS , DEFAULT_EXTERNAL_LINK_TARGET , PDF_PASSWORD_FORM_RESPONSES } from './constants.js' ;
14+ import { PAGE_BORDER , LARGE_SCREEN_SIDE_SPACING , DEFAULT_DOCUMENT_OPTIONS , DEFAULT_EXTERNAL_LINK_TARGET , PDF_PASSWORD_FORM_RESPONSES , ROTATION } from './constants.js' ;
1515import { setListAttributes } from './helpers.js' ;
1616
1717type Props = {
@@ -53,7 +53,7 @@ function PDFPreviewer({
5353 contentContainerStyle,
5454 shouldShowErrorComponent = true ,
5555 onLoadError,
56- rotation = 0 ,
56+ rotation = ROTATION . DEG_0 ,
5757} : Props ) : JSX . Element {
5858 const [ pageViewports , setPageViewports ] = useState < PageViewport [ ] > ( [ ] ) ;
5959 const [ numPages , setNumPages ] = useState ( 0 ) ;
@@ -119,7 +119,7 @@ function PDFPreviewer({
119119 const { width : originalWidth , height : originalHeight } = pageViewports [ pageIndex ] ;
120120
121121 // Swap dimensions when rotated 90 or 270 degrees
122- const isRotated90or270 = rotation === 90 || rotation === 270 ;
122+ const isRotated90or270 = rotation === ROTATION . DEG_90 || rotation === ROTATION . DEG_270 ;
123123 const pageViewportWidth = isRotated90or270 ? originalHeight : originalWidth ;
124124 const pageViewportHeight = isRotated90or270 ? originalWidth : originalHeight ;
125125
@@ -240,7 +240,12 @@ function PDFPreviewer({
240240 ref = { containerRef }
241241 style = { { ...styles . container , ...containerStyle } }
242242 >
243- < div style = { { ...styles . innerContainer , ...( shouldRequestPassword ? styles . invisibleContainer : { } ) } } >
243+ < div
244+ style = { {
245+ ...styles . innerContainer ,
246+ ...( shouldRequestPassword ? styles . invisibleContainer : { } ) ,
247+ } }
248+ >
244249 < Document
245250 file = { file }
246251 options = { DEFAULT_DOCUMENT_OPTIONS }
@@ -262,7 +267,14 @@ function PDFPreviewer({
262267 itemCount = { numPages }
263268 itemSize = { calculatePageHeight }
264269 estimatedItemSize = { calculatePageHeight ( 0 ) }
265- itemData = { { pageWidth, estimatedPageHeight, calculatePageHeight, getDevicePixelRatio, containerHeight, numPages} }
270+ itemData = { {
271+ pageWidth,
272+ estimatedPageHeight,
273+ calculatePageHeight,
274+ getDevicePixelRatio,
275+ containerHeight,
276+ numPages,
277+ } }
266278 >
267279 { PageRenderer }
268280 </ List >
0 commit comments