Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Fit the viewer page bar to narrow workbenches (#7909)

Anthony Stirling49de4aec1411
diff --git a/frontend/editor/src/core/components/viewer/PdfViewerToolbar.css b/frontend/editor/src/core/components/viewer/PdfViewerToolbar.css
index 41ab744bbd..4cc56de328 100644
--- a/frontend/editor/src/core/components/viewer/PdfViewerToolbar.css
+++ b/frontend/editor/src/core/components/viewer/PdfViewerToolbar.css
@@ -12,9 +12,22 @@
itself, so it only plays where the bar actually enters from off-screen —
mirroring the workbench top bar's 280ms ease, upwards instead of downwards. */
.pdf-viewer-toolbar-dock {
+ container-type: inline-size;
animation: pdf-viewer-toolbar-in 280ms ease both;
}
+@container (max-width: 38rem) {
+ .pdf-viewer-toolbar-zoom-slider {
+ display: none;
+ }
+}
+
+@container (max-width: 34rem) {
+ .pdf-viewer-toolbar-wide-only {
+ display: none;
+ }
+}
+
@keyframes pdf-viewer-toolbar-in {
from {
/* The bar's own height plus its gutter, so it starts fully off-screen
diff --git a/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsx b/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsx
index 453a863ee2..a7aa1869cd 100644
--- a/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsx
+++ b/frontend/editor/src/core/components/viewer/PdfViewerToolbar.tsx
@@ -167,6 +167,7 @@ export function PdfViewerToolbar({
<ActionIcon
variant="tertiary"
size={buttonSize}
+ className="pdf-viewer-toolbar-wide-only"
onClick={handleFirstPage}
disabled={scrollState.currentPage === 1}
style={{ minWidth: buttonMinWidth }}
@@ -238,6 +239,7 @@ export function PdfViewerToolbar({
<ActionIcon
variant="tertiary"
size={buttonSize}
+ className="pdf-viewer-toolbar-wide-only"
onClick={handleLastPage}
disabled={scrollState.currentPage === scrollState.totalPages}
style={{ minWidth: buttonMinWidth }}
@@ -262,6 +264,7 @@ export function PdfViewerToolbar({
<ActionIcon
variant={isDualPageActive ? "primary" : "secondary"}
size={buttonSize}
+ className="pdf-viewer-toolbar-wide-only"
onClick={handleDualPageToggle}
disabled={scrollState.totalPages <= 1}
style={{ minWidth: buttonMinWidth }}
@@ -296,6 +299,7 @@ export function PdfViewerToolbar({
<ActionIcon
variant={pdfRenderMode !== "normal" ? "primary" : "secondary"}
size={buttonSize}
+ className="pdf-viewer-toolbar-wide-only"
onClick={cyclePdfRenderMode}
style={{ minWidth: buttonMinWidth }}
aria-label={
@@ -329,6 +333,7 @@ export function PdfViewerToolbar({
<ZoomOutIcon fontSize="small" />
</ActionIcon>
<Slider
+ className="pdf-viewer-toolbar-zoom-slider"
value={Math.min(Math.max(displayZoomPercent, 20), 500)}
min={20}
max={500}