Skip to content

Commit d935fb1

Browse files
authored
Only push scrolling down when Footer is present (#2807)
1 parent a652958 commit d935fb1

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.changeset/cold-cameras-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gitbook': patch
3+
---
4+
5+
Don't add extra page scroll when footer is not present

packages/gitbook/src/app/middleware/(site)/(content)/[[...pathname]]/not-found.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ export default async function NotFound() {
1515

1616
return (
1717
<div
18-
className={tcls('flex-1', 'flex', 'flex-row', 'items-center', 'justify-center', 'py-9')}
18+
className={tcls(
19+
'flex-1',
20+
'flex',
21+
'flex-row',
22+
'items-center',
23+
'justify-center',
24+
'py-9',
25+
'min-h-[calc(100vh-64px)] lg:min-h-fit',
26+
)}
1927
>
2028
<div className={tcls('max-w-80')}>
2129
<h2 className={tcls('text-2xl', 'font-semibold', 'mb-2')}>

packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ export async function SpaceLayout(props: {
7878
const visitorAuthToken = await getCurrentVisitorToken();
7979
const enabled = await shouldTrackEvents();
8080

81+
const withFooter =
82+
customization.themes.toggeable ||
83+
customization.footer.copyright ||
84+
customization.footer.logo ||
85+
customization.footer.groups?.length;
86+
8187
return (
8288
<InsightsProvider
8389
enabled={enabled}
@@ -103,7 +109,7 @@ export async function SpaceLayout(props: {
103109
CONTAINER_STYLE,
104110

105111
// Ensure the footer is display below the viewport even if the content is not enough
106-
`min-h-[calc(100vh-64px)]`,
112+
withFooter && 'min-h-[calc(100vh-64px)]',
107113
withTopHeader ? null : 'lg:min-h-screen',
108114
)}
109115
>
@@ -174,10 +180,7 @@ export async function SpaceLayout(props: {
174180
</div>
175181
</div>
176182

177-
{customization.themes.toggeable ||
178-
customization.footer.copyright ||
179-
customization.footer.logo ||
180-
customization.footer.groups?.length ? (
183+
{withFooter ? (
181184
<Footer space={space} context={contentRefContext} customization={customization} />
182185
) : null}
183186

0 commit comments

Comments
 (0)