Progressive loading (#79)

* Suspense boundary and progressive loading on blocks

* Start refactoring to better leverage app router

* Use skeleton for page layout

* Improve dynamic toc

* Switch page full width to be client side only

* Format

* Remove old PageLoading

* Fix first page not marked as active

* Close search when clicking search link
This commit is contained in:
Samy Pessé
2023-12-28 14:38:15 +01:00
committed by GitHub
parent 1c2d68c518
commit 2fdf3e3838
41 changed files with 722 additions and 574 deletions
+3 -21
View File
@@ -2,11 +2,7 @@ import { Collection, CustomizationSettings, Space } from '@gitbook/api';
import { CustomizationHeaderPreset } from '@gitbook/api';
import { Suspense } from 'react';
import {
CONTAINER_MAX_WIDTH_NORMAL,
CONTAINER_PADDING,
HEADER_HEIGHT_DESKTOP,
} from '@/components/layout';
import { CONTAINER_STYLE, HEADER_HEIGHT_DESKTOP } from '@/components/layout';
import { t, getSpaceLanguage } from '@/intl/server';
import { ContentRefContext } from '@/lib/references';
import { tcls } from '@/lib/tailwind';
@@ -24,27 +20,14 @@ export function Header(props: {
collection: Collection | null;
collectionSpaces: Space[];
context: ContentRefContext;
asFullWidth: boolean;
customization: CustomizationSettings;
withTopHeader?: boolean;
}) {
const {
context,
space,
collection,
collectionSpaces,
asFullWidth,
customization,
withTopHeader,
} = props;
const { context, space, collection, collectionSpaces, customization, withTopHeader } = props;
const isCustomizationDefault =
customization.header.preset === CustomizationHeaderPreset.Default;
const isCustomizationCustom = customization.header.preset === CustomizationHeaderPreset.Custom;
console.log('Header.tsx: isCustomizationDefault: ', isCustomizationDefault);
return (
<header
className={tcls(
@@ -79,8 +62,7 @@ export function Header(props: {
'align-center',
'justify-between',
'w-full',
CONTAINER_PADDING,
asFullWidth ? null : [CONTAINER_MAX_WIDTH_NORMAL, 'mx-auto'],
CONTAINER_STYLE,
)}
>
<HeaderLogo collection={collection} space={space} customization={customization} />