Only push scrolling down when Footer is present (#2807)

This commit is contained in:
Scott Cazan
2025-02-05 12:26:31 +01:00
committed by GitHub
parent a6529584a5
commit d935fb1b2e
3 changed files with 22 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'gitbook': patch
---
Don't add extra page scroll when footer is not present
@@ -15,7 +15,15 @@ export default async function NotFound() {
return (
<div
className={tcls('flex-1', 'flex', 'flex-row', 'items-center', 'justify-center', 'py-9')}
className={tcls(
'flex-1',
'flex',
'flex-row',
'items-center',
'justify-center',
'py-9',
'min-h-[calc(100vh-64px)] lg:min-h-fit',
)}
>
<div className={tcls('max-w-80')}>
<h2 className={tcls('text-2xl', 'font-semibold', 'mb-2')}>
@@ -78,6 +78,12 @@ export async function SpaceLayout(props: {
const visitorAuthToken = await getCurrentVisitorToken();
const enabled = await shouldTrackEvents();
const withFooter =
customization.themes.toggeable ||
customization.footer.copyright ||
customization.footer.logo ||
customization.footer.groups?.length;
return (
<InsightsProvider
enabled={enabled}
@@ -103,7 +109,7 @@ export async function SpaceLayout(props: {
CONTAINER_STYLE,
// Ensure the footer is display below the viewport even if the content is not enough
`min-h-[calc(100vh-64px)]`,
withFooter && 'min-h-[calc(100vh-64px)]',
withTopHeader ? null : 'lg:min-h-screen',
)}
>
@@ -174,10 +180,7 @@ export async function SpaceLayout(props: {
</div>
</div>
{customization.themes.toggeable ||
customization.footer.copyright ||
customization.footer.logo ||
customization.footer.groups?.length ? (
{withFooter ? (
<Footer space={space} context={contentRefContext} customization={customization} />
) : null}