diff --git a/.changeset/moody-badgers-teach.md b/.changeset/moody-badgers-teach.md new file mode 100644 index 0000000000..8036a644c5 --- /dev/null +++ b/.changeset/moody-badgers-teach.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Improve vertical alignment of site items and fix floating page aside diff --git a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css index 2d38b85c5e..bb3c583dba 100644 --- a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css +++ b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css @@ -147,7 +147,7 @@ } .openapi-column-preview-body { - @apply flex flex-col gap-4 sticky top-4 site-header:top-20 site-header:xl:max-2xl:top-32 site-header-sections:top-32 site-header-sections:xl:max-2xl:top-44 print-mode:static; + @apply flex flex-col gap-4 sticky top-[calc(var(--toc-top-offset)+5rem)] print-mode:static; } .openapi-column-preview pre { diff --git a/packages/gitbook/src/components/PageAside/PageAside.tsx b/packages/gitbook/src/components/PageAside/PageAside.tsx index ffdabfc9a4..8d87e04f11 100644 --- a/packages/gitbook/src/components/PageAside/PageAside.tsx +++ b/packages/gitbook/src/components/PageAside/PageAside.tsx @@ -32,33 +32,27 @@ export function PageAside(props: { withPageFeedback: boolean; }) { const { page, document, withPageFeedback, context } = props; - const { customization, site, space } = context; - const language = getSpaceLanguage(customization); - const pdfHref = context.linker.toPathInSpace( - `~gitbook/pdf?${getPDFURLSearchParams({ - page: page.id, - only: true, - limit: 100, - }).toString()}` - ); return ( ); } +function PageAsideHeader(props: { context: GitBookSiteContext }) { + const { context } = props; + const language = getSpaceLanguage(context.customization); + + return ( +
+ + {t(language, 'on_this_page')} + +
+ ); +} + async function PageAsideSections(props: { document: JSONDocument; context: GitBookSiteContext }) { const { document, context } = props; const sections = await getDocumentSections(context, document); - return sections.length > 1 ? : null; + return sections.length > 1 ? ( +
+ +
+ ) : null; +} + +function PageAsideActions(props: { + withPageFeedback: boolean; + context: GitBookSiteContext; + page: RevisionPageDocument; +}) { + const { page, withPageFeedback, context } = props; + const { customization, space } = context; + const language = getSpaceLanguage(customization); + + const pdfHref = context.linker.toPathInSpace( + `~gitbook/pdf?${getPDFURLSearchParams({ + page: page.id, + only: true, + limit: 100, + }).toString()}` + ); + + return ( +
+ {withPageFeedback ? ( + + + + ) : null} + {customization.git.showEditLink && space.gitSync?.url && page.git ? ( +
+ + + {t(language, 'edit_on_git', getGitSyncName(space))} + +
+ ) : null} + {customization.pdf.enabled ? ( +
+ + + {t(language, 'pdf_download')} + +
+ ) : null} +
+ ); +} + +async function PageAsideFooter(props: { context: GitBookSiteContext }) { + const { context } = props; + const { customization, site, space } = context; + + return ( +
+ {/* Mode Switcher */} + {customization.themes.toggeable ? ( +
+ + + +
+ ) : null} + +
+ ); } function getGitSyncName(space: Space): string { diff --git a/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx b/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx index 1c57bc6388..4d3dc0e6e2 100644 --- a/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx +++ b/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx @@ -40,7 +40,7 @@ export function ScrollSectionsList(props: { sections: DocumentSection[] }) { }); return ( -