#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
fix(viewer): dynamic page number input width based on total page count (#6607)
briosa4ffdc7831f8
diff --git a/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsx b/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsxindex 893cd35d44..011b1baf17 100644--- a/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsx+++ b/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsx@@ -18,6 +18,12 @@ import ZoomInIcon from "@mui/icons-material/ZoomIn";import ZoomOutIcon from "@mui/icons-material/ZoomOut";import MoreVertIcon from "@mui/icons-material/MoreVert";+// Sizing constants for the page number input+const MIN_PAGE_DIGITS = 2;+const MIN_INPUT_WIDTH_PX = 48;+const BASE_INPUT_WIDTH_PX = 32;+const PX_PER_DIGIT = 8;+interface PdfViewerToolbarProps {// Page navigation props (placeholders for now)currentPage?: number;@@ -131,6 +137,15 @@ export function PdfViewerToolbar({scrollActions.scrollToLastPage();};+ const totalPagesDigits = Math.max(+ MIN_PAGE_DIGITS,+ (scrollState.totalPages || 1).toString().length,+ );+ const inputWidth = Math.max(+ MIN_INPUT_WIDTH_PX,+ BASE_INPUT_WIDTH_PX + totalPagesDigits * PX_PER_DIGIT,+ );+return (<Paperradius="xl xl 0 0"@@ -195,10 +210,13 @@ export function PdfViewerToolbar({hideControlsstyles={{input: {- width: 48,+ width: inputWidth,textAlign: "center",fontWeight: 500,fontSize: 16,+ paddingLeft: 4,+ paddingRight: 4,+ boxSizing: "border-box",},}}/>