rework/lightweight #12

Merged
GauthierWebDev merged 106 commits from rework/lightweight into main 2025-04-21 16:27:38 +00:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit 08c5ecfb6a - Show all commits

View File

@ -63,7 +63,7 @@ function PageLink(props: PageLinkProps) {
} }
export function PrevNextLinks() { export function PrevNextLinks() {
const { urlPathname } = usePageContext(); const pageContext = usePageContext();
const allLinks = navigation const allLinks = navigation
.flatMap((section) => section.links) .flatMap((section) => section.links)
@ -72,13 +72,15 @@ export function PrevNextLinks() {
}); });
const getNeighboringLinks = () => { const getNeighboringLinks = () => {
const linkIndex = allLinks.findIndex((link) => link.href === urlPathname); const linkIndex = allLinks.findIndex(
(link) => link.href === pageContext.urlPathname,
);
if (linkIndex === -1) return [null, null]; if (linkIndex === -1) return [null, null];
const previousPage = allLinks[linkIndex - 1] || null; const previousPage = allLinks[linkIndex - 1] || null;
let nextPage = allLinks[linkIndex + 1] || null; let nextPage = allLinks[linkIndex + 1] || null;
if (nextPage?.href === urlPathname) { if (nextPage?.href === pageContext.urlPathname) {
nextPage = allLinks[linkIndex + 2] || null; nextPage = allLinks[linkIndex + 2] || null;
} }

View File

@ -114,13 +114,13 @@ function SearchInput() {
); );
} }
function HighlightQuery({ text, query }: { text: string; query: string }) { function HighlightQuery(props: { text: string; query: string }) {
return ( return (
<Highlighter <Highlighter
highlightClass="group-aria-selected:underline bg-transparent text-violet-600" highlightClass="group-aria-selected:underline bg-transparent text-violet-600"
searchWords={[query]} searchWords={[props.query]}
autoEscape={true} autoEscape={true}
textToHighlight={text} textToHighlight={props.text}
/> />
); );
} }