Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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/fuzzy-bulldogs-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gitbook": patch
---

Add fullwidth page option
18 changes: 18 additions & 0 deletions packages/gitbook/src/components/DocumentView/Blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ type UnwrappedBlocksProps<TBlock extends DocumentBlock> = DocumentContextProps &
isOffscreen?: boolean;
};

/* Blocks that can be full width are automatically expanded on full-width pages.
* Ideally we'd rely on the block type to determine if it can be full width, but
* the block's `fullWidth` property does not differentiate between `undefined` and `false`.
* So instead we hardcode a list of blocks that can be full width. */
const FULL_WIDTH_BLOCKS = [
'table',
'tabs',
'integration',
'openapi',
'images',
'embed',
'columns',
'code',
'content-ref',
'hint',
];

/**
* Renders a list of blocks without a wrapper element.
*/
Expand All @@ -72,6 +89,7 @@ export function UnwrappedBlocks<TBlock extends DocumentBlock>(props: UnwrappedBl
node.data && 'fullWidth' in node.data && node.data.fullWidth
? 'max-w-screen-2xl'
: 'page-full-width:ml-0 max-w-3xl',
FULL_WIDTH_BLOCKS.includes(node.type) && 'page-full-width:max-w-screen-2xl',
blockStyle,
]}
isEstimatedOffscreen={isOffscreen}
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/PageAside/PageAside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function PageAside(props: {
'chat-open:xl:max-3xl:max-w-0',
'chat-open:xl:max-3xl:ml-0',

'transition-all duration-300',
'xl:transition-all xl:duration-300',
'[transition-behavior:allow-discrete]',

'flex-col',
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/PageBody/PageBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function PageBody(props: {
LINK_PREVIEW_MAX_COUNT
)
: false;
const pageFullWidth = page.id === 'wtthNFMqmEQmnt5LKR0q';
const pageFullWidth = page.layout.width === 'wide';
const asFullWidth = pageFullWidth || contentFullWidth;
const language = getSpaceLanguage(customization);
const updatedAt = page.updatedAt ?? page.createdAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ export async function PageBodyBlankslate(props: {
className={tcls(
'grid',
'max-w-3xl',
'page-full-width:max-w-screen-2xl',
'w-full',
'mx-auto',
'gap-4',
'grid-cols-1',
'sm:grid-cols-2'
'sm:grid-cols-2',
'page-full-width:md:grid-cols-3'
)}
>
{pageElements}
Expand Down