Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0cf494f
Rework page layout
zenoachtig Feb 16, 2026
5779b72
Update TableOfContents.tsx
zenoachtig Feb 16, 2026
5ccd2dc
Comments & rename
zenoachtig Feb 16, 2026
87443db
Update PageCover.tsx
zenoachtig Feb 16, 2026
4c552c5
Merge branch 'main' into page-layout-rework
zenoachtig Feb 24, 2026
1282c3f
Add pageaside sidesheet
zenoachtig Feb 24, 2026
42f2076
Update EmbeddableDocsPage.tsx
zenoachtig Feb 24, 2026
081f9e6
Merge branch 'main' into page-layout-rework
zenoachtig Mar 16, 2026
f5902a6
Improved version
zenoachtig Mar 16, 2026
3397549
Refactor
zenoachtig Mar 16, 2026
4ca020c
Format
zenoachtig Mar 16, 2026
0a26acf
Merge branch 'main' into page-layout-rework
zenoachtig Mar 18, 2026
2be16ce
First naive pass
zenoachtig Mar 31, 2026
656510f
Update PageCover.tsx
zenoachtig Mar 31, 2026
c93d777
Finish refactor
zenoachtig Apr 1, 2026
9ebad52
Merge branch 'main' into page-layout-rework
zenoachtig Apr 1, 2026
ae0b730
Try-out showing the outline earlier for pages with API block
zenoachtig Apr 1, 2026
984a822
Cleanup / refactor
zenoachtig Apr 1, 2026
e813918
Tweaks to cover and page actions
zenoachtig Apr 1, 2026
2e921c2
Update PageAside.tsx
zenoachtig Apr 1, 2026
1823d42
"On this page" header & mobile TOC margin
zenoachtig Apr 1, 2026
db846c9
Fix animations that were causing header issues
zenoachtig Apr 1, 2026
83bfe42
Update tests
zenoachtig Apr 2, 2026
1ec9bc6
Update internal.spec.ts
zenoachtig Apr 2, 2026
87ded02
Update PageHeader.tsx
zenoachtig Apr 2, 2026
6709ca7
Update PageHeader.tsx
zenoachtig Apr 8, 2026
e45c6e9
Merge branch 'main' into page-layout-rework
zenoachtig Apr 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/metal-ghosts-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gitbook": minor
---

Rework page layout
4 changes: 3 additions & 1 deletion packages/gitbook/e2e/internal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,9 @@ const testCases: TestsCase[] = [
run: async (page) => {
await expect(page.locator('[data-testid="table-of-contents"]')).toBeVisible();
// Trademark exists by default
await expect(page.getByTestId('gb-trademark')).toHaveCount(1);
expect(await page.getByTestId('gb-trademark').count()).toBeGreaterThanOrEqual(
1
);

// Go to another page with the customization query to disable the trademark
const pageBlocks = new URL(page.url());
Expand Down
11 changes: 5 additions & 6 deletions packages/gitbook/src/components/DocumentView/Blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { DocumentBlock, JSONDocument } from '@gitbook/api';

import { type ClassValue, tcls } from '@/lib/tailwind';

import { CONTENT_STYLE, CONTENT_STYLE_REDUCED } from '../layout';
import { Block } from './Block';
import type { DocumentContextProps } from './DocumentView';
import { isBlockOffscreen } from './utils';
Expand Down Expand Up @@ -63,7 +64,7 @@ const FULL_WIDTH_BLOCKS: DocumentBlock['type'][] = [
'columns',
'code',
'content-ref',
'hint',
'divider',
];

const LIST_BLOCKS: DocumentBlock['type'][] = ['list-ordered', 'list-tasks', 'list-unordered'];
Expand All @@ -89,12 +90,10 @@ export function UnwrappedBlocks<TBlock extends DocumentBlock>(props: UnwrappedBl
key={node.key || `${node.type}-${index}`}
block={node}
style={[
'mx-auto page-width-wide:mx-0 w-full decoration-primary/6',
node.data && 'fullWidth' in node.data && node.data.fullWidth
? 'max-w-screen-xl'
: 'max-w-3xl',
'decoration-primary/6',
FULL_WIDTH_BLOCKS.includes(node.type) ? CONTENT_STYLE : CONTENT_STYLE_REDUCED,

!LIST_BLOCKS.includes(node.type) && 'print:break-inside-avoid',
FULL_WIDTH_BLOCKS.includes(node.type) && 'page-width-wide:max-w-full',
blockStyle,
]}
isEstimatedOffscreen={isOffscreen}
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/DocumentView/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import type { BlockProps } from './Block';
export function Divider(props: BlockProps<DocumentBlockDivider>) {
const { style } = props;

return <hr className={tcls(style, 'page-width-wide:max-w-full border-tint-subtle')} />;
return <hr className={tcls(style, 'border-tint-subtle')} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function DocumentViewSkeleton(props: { document: JSONDocument; blockStyle
style={[
'mx-auto w-full decoration-primary/6',
block.data && 'fullWidth' in block.data && block.data.fullWidth
? 'max-w-screen-xl'
? 'max-w-6xl'
: 'max-w-3xl',
blockStyle,
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function StepperStep(props: BlockProps<DocumentBlockStepperStep>) {
})();

return (
<div className={tcls('mx-auto flex w-full max-w-3xl flex-row gap-4 md:gap-8', style)}>
<div className={tcls('flex flex-row gap-4 md:gap-8', style)}>
<div className="relative select-none">
<div
className={tcls(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ export async function EmbeddableDocsPage(
<EmbeddableIframeButtons />
<EmbeddableIframeCloseButton />
</EmbeddableFrameSidebar>
<EmbeddableFrameMain data-testid="embed-docs-page">
<EmbeddableFrameMain
data-testid="embed-docs-page"
className={variants.generic.length > 1 ? 'has-sidebar' : 'no-sidebar'}
>
<div className="relative flex flex-col border-tint-subtle border-b theme-bold:bg-header-background">
<EmbeddableFrameHeader className="theme-bold:text-header-link">
<HeaderMobileMenu className="-ml-2 page-no-toc:hidden theme-bold:text-header-link hover:theme-bold:bg-header-link/3 hover:theme-bold:text-header-link lg:hidden" />
<HeaderMobileMenu className="-ml-2 no-sidebar:hidden theme-bold:text-header-link hover:theme-bold:bg-header-link/3 hover:theme-bold:text-header-link lg:hidden" />
<EmbeddableFrameHeaderMain>
<EmbeddableFrameTitle>{context.site.title}</EmbeddableFrameTitle>
</EmbeddableFrameHeaderMain>
Expand Down Expand Up @@ -105,6 +108,7 @@ export async function EmbeddableDocsPage(
trailing={{ fade: false, button: true }}
>
<TableOfContents
className="layout-wide:no-sidebar:lg:hidden!"
context={context}
withTrademark={false}
header={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ export const EmbeddableFrame = React.forwardRef<HTMLDivElement, EmbeddableFrameP
}
);

export function EmbeddableFrameMain(props: React.ComponentProps<'div'>) {
const { children, ...rest } = props;
export function EmbeddableFrameMain(
props: React.ComponentProps<'div'> & { className?: ClassValue }
) {
const { children, className, ...rest } = props;

return (
<div className="flex flex-1 flex-col overflow-hidden" {...rest}>
<div className={tcls('flex flex-1 flex-col overflow-hidden', className)} {...rest}>
{children}
</div>
);
Expand Down
21 changes: 6 additions & 15 deletions packages/gitbook/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { partition } from '@/lib/arrays';
import { tcls } from '@/lib/tailwind';

import { ThemeToggler } from '../ThemeToggler';
import { CONTAINER_STYLE } from '../layout';
import { CONTAINER_STYLE, CONTENT_STYLE } from '../layout';
import { FooterLinksGroup } from './FooterLinksGroup';
import { SocialAccountButton } from './SocialAccounts';

Expand Down Expand Up @@ -48,16 +48,11 @@ export function Footer(props: { context: GitBookSiteContext }) {
>
<div
className={tcls(
'mx-auto flex @xs:grid @4xl:max-w-none! max-w-3xl site-width-wide:max-w-screen-2xl flex-col justify-between gap-12',
CONTENT_STYLE,
'flex @xs:grid @4xl:max-w-none! flex-col justify-between gap-12',
'grid-cols-[auto_auto]',
'@4xl:grid-cols-[18rem_minmax(auto,48rem)_auto]',
'@7xl:grid-cols-[18rem_minmax(auto,48rem)_14rem]',
'@4xl:site-width-wide:grid-cols-[18rem_minmax(auto,80rem)_auto]',
'@7xl:site-width-wide:grid-cols-[18rem_minmax(auto,80rem)_14rem]',
'@4xl:page-no-toc:grid-cols-[minmax(auto,48rem)_auto]',
'@7xl:page-no-toc:grid-cols-[14rem_minmax(auto,48rem)_14rem]',
'@4xl:[body:has(.site-width-wide,.page-no-toc)_&]:grid-cols-[minmax(auto,90rem)_auto]',
'@7xl:[body:has(.site-width-wide,.page-no-toc)_&]:grid-cols-[14rem_minmax(auto,90rem)_14rem]'
'@7xl:grid-cols-[18rem_minmax(auto,48rem)_14rem]'
)}
>
{
Expand Down Expand Up @@ -113,12 +108,8 @@ export function Footer(props: { context: GitBookSiteContext }) {
{
// Navigation groups (split into equal columns)
customization.footer.groups?.length > 0 ? (
<div
className={tcls(
'@4xl:page-has-toc:col-span-1 @7xl:page-no-toc:col-span-1 col-span-2 @4xl:page-has-toc:col-start-2 @7xl:page-no-toc:col-start-2'
)}
>
<div className="mx-auto flex max-w-3xl site-width-wide:max-w-screen-2xl @xl:flex-row flex-col @xl:gap-6 gap-10">
<div className={tcls('col-span-2')}>
<div className="mx-auto flex @xl:flex-row flex-col @xl:gap-6 gap-10">
{partition(customization.footer.groups, FOOTER_COLUMNS).map(
(column, columnIndex) => (
<div
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function Header(props: {
'hover:site-header:theme-bold:bg-header-link/3',
variants.generic.length > 1
? 'lg:hidden'
: 'page-no-toc:hidden lg:hidden'
: 'no-sidebar:hidden lg:hidden'
)}
/>
<HeaderLogo context={context} />
Expand Down
Loading
Loading