@@ -9,7 +9,12 @@ import { Button } from "./ui/button";
99import { downloadFile } from "../lib/utils/download" ;
1010import ShareButton from "./ShareButton" ;
1111import Loader from "./ui/loader" ;
12- import { FaGreaterThan , FaLessThan } from "react-icons/fa6" ;
12+ import {
13+ FaGreaterThan ,
14+ FaLessThan ,
15+ FaAngleUp ,
16+ FaAngleDown ,
17+ } from "react-icons/fa6" ;
1318
1419pdfjs . GlobalWorkerOptions . workerSrc =
1520 "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.8.69/pdf.worker.min.mjs" ;
@@ -115,11 +120,11 @@ export default function PdfViewer({ url, name }: PdfViewerProps) {
115120 } ;
116121
117122 const downloadPDF = async ( ) => {
118- if ( window . dataLayer ) {
123+ if ( window . dataLayer ) {
119124 window . dataLayer . push ( {
120- ' event' : ' pdf_download_start' ,
121- ' paper_title' : name ,
122- ' paper_url' : url ,
125+ event : " pdf_download_start" ,
126+ paper_title : name ,
127+ paper_url : url ,
123128 } ) ;
124129 }
125130 const fileName = `${ name } .pdf` ;
@@ -195,10 +200,10 @@ export default function PdfViewer({ url, name }: PdfViewerProps) {
195200 } , [ ] ) ;
196201
197202 return (
198- < div className = "flex flex-col items -center p-3 md:p-0" >
203+ < div className = "flex w-full justify -center gap-6 p-3 md:p-0" >
199204 < div
200205 ref = { containerRef }
201- className = "max-h-[70vh] w-full overflow-auto bg-[#F3F5FF] px-4 shadow-lg dark:bg-[#070114]"
206+ className = "max-h-[70vh] overflow-auto rounded-lg bg-[#F3F5FF] px-4 shadow-lg dark:bg-[#070114]"
202207 >
203208 < Document
204209 file = { url }
@@ -300,61 +305,72 @@ export default function PdfViewer({ url, name }: PdfViewerProps) {
300305 </ div >
301306
302307 { ! isFullscreen && (
303- < div className = "mt-4 flex flex -col items-center gap-4 rounded-lg bg-[#F3F5FF] p-4 shadow dark:bg-[#262635] sm:flex-row " >
304- < div className = "flex items-center gap-2 " >
308+ < div className = "flex h-fit flex-col items-center gap-4 rounded-lg bg-[#F3F5FF] p-4 shadow dark:bg-[#262635]" >
309+ < div className = "flex flex-col items-center gap-3 " >
305310 < Button
306- onClick = { goToPreviousPage }
307- disabled = { pageNumber <= 1 }
308- className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1] disabled:bg-[#706b7a] disabled:opacity-50"
311+ onClick = { toggleFullscreen }
312+ className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1]"
309313 >
310- < FaLessThan />
314+ { isFullscreen ? < Minimize2 /> : < Maximize2 /> }
311315 </ Button >
312- < input
313- type = "text"
314- value = { inputValue }
315- onChange = { ( e ) => setInputValue ( e . target . value ) }
316- onKeyDown = { ( e ) => handlePageChange ( e ) }
317- onFocus = { ( ) => setInputValue ( "" ) }
318- className = "h-10 w-16 rounded border p-1 text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
319- />
320- < span > of { numPages ?? 1 } </ span >
316+
321317 < Button
322- onClick = { goToNextPage }
323- disabled = { pageNumber >= ( numPages ?? 1 ) }
324- className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1] disabled:bg-[#706b7a] disabled:opacity-50"
318+ onClick = { downloadPDF }
319+ className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1]"
325320 >
326- < FaGreaterThan />
321+ < Download />
327322 </ Button >
323+
324+ < ShareButton />
328325 </ div >
329326
330- < div className = "flex items-center gap-2 " >
327+ < div className = "flex flex-col items-center gap-3 " >
331328 < Button
332329 onClick = { zoomOut }
333330 disabled = { scale <= 0.25 }
334331 className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1] disabled:bg-gray-300"
335332 >
336333 < ZoomOut />
337334 </ Button >
338- < span > { ( scale * 100 ) . toFixed ( 0 ) } %</ span >
335+
336+ < span className = "text-sm" > { ( scale * 100 ) . toFixed ( 0 ) } %</ span >
337+
339338 < Button
340339 onClick = { zoomIn }
341340 disabled = { scale >= 3 }
342341 className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1] disabled:bg-gray-300"
343342 >
344343 < ZoomIn />
345344 </ Button >
346- < ShareButton />
345+ </ div >
346+
347+ < div className = "mt-2 flex flex-col items-center gap-3" >
348+ < div className = "flex flex-col items-center" >
349+ < input
350+ type = "text"
351+ value = { inputValue }
352+ onChange = { ( e ) => setInputValue ( e . target . value ) }
353+ onKeyDown = { ( e ) => handlePageChange ( e ) }
354+ onFocus = { ( ) => setInputValue ( "" ) }
355+ className = "h-10 w-16 rounded border p-1 text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
356+ />
357+ < span className = "mt-1 text-sm" > of { numPages ?? 1 } </ span >
358+ </ div >
359+
347360 < Button
348- onClick = { downloadPDF }
349- className = "aspect-square h-10 w-10 p-0"
361+ onClick = { goToNextPage }
362+ disabled = { pageNumber >= ( numPages ?? 1 ) }
363+ className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1] disabled:bg-[#706b7a] disabled:opacity-50"
350364 >
351- < Download />
365+ < FaAngleUp />
352366 </ Button >
367+
353368 < Button
354- onClick = { toggleFullscreen }
355- className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1]"
369+ onClick = { goToPreviousPage }
370+ disabled = { pageNumber <= 1 }
371+ className = "h-10 w-10 rounded p-0 text-white transition hover:bg-[#6536c1] disabled:bg-[#706b7a] disabled:opacity-50"
356372 >
357- { isFullscreen ? < Minimize2 /> : < Maximize2 /> }
373+ < FaAngleDown />
358374 </ Button >
359375 </ div >
360376 </ div >
0 commit comments