Skip to content

Commit

Permalink
upd react-pdf height
Browse files Browse the repository at this point in the history
  • Loading branch information
JiangShuuu committed Dec 24, 2023
1 parent fe120a8 commit 3ac010a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Binary file modified public/dashboard-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions src/components/PdfRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const PdfRenderer = ({ url }: PdfRendererProps) => {
resolver: zodResolver(CustomPageValidator)
})

const { width, ref } = useResizeDetector()
console.log(errors)

const { width, ref, height } = useResizeDetector()

const handlePageSubmit = ({ page }: TCustomPageValidator) => {
setCurrPage(Number(page))
Expand All @@ -84,6 +86,7 @@ const PdfRenderer = ({ url }: PdfRendererProps) => {
>
<ChevronDown className="h-4 w-4" />
</Button>

<div className="flex items-center gap-1.5">
<Input
{...register('page')}
Expand All @@ -99,6 +102,7 @@ const PdfRenderer = ({ url }: PdfRendererProps) => {
<span>{numPages ?? 'x'}</span>
</p>
</div>

<Button
disabled={numPages === undefined || currPage === numPages}
onClick={() => {
Expand Down Expand Up @@ -143,7 +147,7 @@ const PdfRenderer = ({ url }: PdfRendererProps) => {

<div className="max-h-screen w-full flex-1">
<SimpleBar autoHide={false} className="max-h-[calc(100vh-10rem)]">
<div ref={ref}>
<div ref={ref} className="h-[calc(100vh-10rem)]">
<Document
loading={
<div className="flex justify-center">
Expand All @@ -159,7 +163,6 @@ const PdfRenderer = ({ url }: PdfRendererProps) => {
}}
onLoadSuccess={({ numPages }) => setNumPages(numPages)}
file={url}
className="max-h-full"
>
{isLoading && renderedScale ? (
<Page
Expand Down

0 comments on commit 3ac010a

Please sign in to comment.