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
+1
View File
@@ -195,6 +195,7 @@ function SearchModalBody(
query: state.query,
});
}}
onClose={onClose}
/>
) : null}
{state.query && state.ask && withAsk ? (
@@ -11,15 +11,17 @@ export const SearchPageResultItem = React.forwardRef(function SearchPageResultIt
query: string;
item: ComputedPageResult;
active: boolean;
onClick: () => void;
},
ref: React.Ref<HTMLAnchorElement>,
) {
const { query, item, active } = props;
const { query, item, active, onClick } = props;
return (
<Link
ref={ref}
href={item.href}
onClick={onClick}
className={tcls(
'flex',
'flex-row',
+4 -1
View File
@@ -33,10 +33,11 @@ export const SearchResults = React.forwardRef(function SearchResults(
spaceId: string;
withAsk: boolean;
onSwitchToAsk: () => void;
onClose: () => void;
},
ref: React.Ref<SearchResultsRef>,
) {
const { query, spaceId, withAsk, onSwitchToAsk } = props;
const { query, spaceId, withAsk, onSwitchToAsk, onClose } = props;
const language = useLanguage();
const debounceTimeout = React.useRef<NodeJS.Timeout | null>(null);
@@ -188,6 +189,7 @@ export const SearchResults = React.forwardRef(function SearchResults(
query={query}
item={item}
active={index === cursor}
onClick={onClose}
/>
);
}
@@ -228,6 +230,7 @@ export const SearchResults = React.forwardRef(function SearchResults(
query={query}
item={item}
active={index === cursor}
onClick={onClose}
/>
);
}
@@ -7,15 +7,16 @@ import { HighlightQuery } from './HighlightQuery';
import type { ComputedSectionResult } from './server-actions';
export const SearchSectionResultItem = React.forwardRef(function SearchSectionResultItem(
props: { query: string; item: ComputedSectionResult; active: boolean },
props: { query: string; item: ComputedSectionResult; active: boolean; onClick: () => void },
ref: React.Ref<HTMLAnchorElement>,
) {
const { query, item, active } = props;
const { query, item, active, onClick } = props;
return (
<Link
ref={ref}
href={item.href}
onClick={onClick}
className={tcls(
'search-section-result-item',
'flex',