From f98146f5b625e89730d11736b398164b59586bd5 Mon Sep 17 00:00:00 2001 From: Steven H Date: Fri, 15 Mar 2024 15:08:41 +0000 Subject: [PATCH] Show a single page when user clicks Export as PDF (#279) --- .../~gitbook/pdf/PageControlButtons.tsx | 26 ++++++++++--------- src/app/(space)/(core)/~gitbook/pdf/page.tsx | 3 ++- src/components/PageAside/PageAside.tsx | 8 +++++- .../~gitbook/pdf/params.ts => lib/urls.ts} | 21 ++++++++++----- 4 files changed, 37 insertions(+), 21 deletions(-) rename src/{app/(space)/(core)/~gitbook/pdf/params.ts => lib/urls.ts} (72%) diff --git a/src/app/(space)/(core)/~gitbook/pdf/PageControlButtons.tsx b/src/app/(space)/(core)/~gitbook/pdf/PageControlButtons.tsx index ab20e8089..9511bd369 100644 --- a/src/app/(space)/(core)/~gitbook/pdf/PageControlButtons.tsx +++ b/src/app/(space)/(core)/~gitbook/pdf/PageControlButtons.tsx @@ -7,14 +7,14 @@ import { useScrollActiveId } from '@/components/hooks'; import { Button } from '@/components/primitives'; import { t, useLanguage } from '@/intl/client'; import { tcls } from '@/lib/tailwind'; - -import { getPDFUrl } from './params'; +import { getPDFUrl } from '@/lib/urls'; /** * Dynamic controls to show active page and to let the user select between modes. */ export function PageControlButtons(props: { pdfHref: string; + singlePageMode: boolean; /** Array of the [pageId, divId] */ pageIds: Array<[string, string]>; /** Total number of pages targetted by the generation */ @@ -22,7 +22,7 @@ export function PageControlButtons(props: { /** Trademark to display */ trademark?: React.ReactNode; }) { - const { pdfHref, pageIds, total, trademark } = props; + const { pdfHref, singlePageMode, pageIds, total, trademark } = props; const language = useLanguage(); @@ -49,15 +49,17 @@ export function PageControlButtons(props: { 'z-50', )} > - + {singlePageMode ? null : ( + + )}