From 08c5ecfb6ae90b9b138d2f5951b48e72f182e2d1 Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Sun, 20 Apr 2025 16:52:17 +0200 Subject: [PATCH] refactor: Update function parameters in HighlightQuery --- app/components/PrevNextLinks.tsx | 8 +++++--- app/components/Search.tsx | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/components/PrevNextLinks.tsx b/app/components/PrevNextLinks.tsx index cc6e732..51f7d8e 100644 --- a/app/components/PrevNextLinks.tsx +++ b/app/components/PrevNextLinks.tsx @@ -63,7 +63,7 @@ function PageLink(props: PageLinkProps) { } export function PrevNextLinks() { - const { urlPathname } = usePageContext(); + const pageContext = usePageContext(); const allLinks = navigation .flatMap((section) => section.links) @@ -72,13 +72,15 @@ export function PrevNextLinks() { }); 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]; const previousPage = allLinks[linkIndex - 1] || null; let nextPage = allLinks[linkIndex + 1] || null; - if (nextPage?.href === urlPathname) { + if (nextPage?.href === pageContext.urlPathname) { nextPage = allLinks[linkIndex + 2] || null; } diff --git a/app/components/Search.tsx b/app/components/Search.tsx index f2f2658..17bb85c 100644 --- a/app/components/Search.tsx +++ b/app/components/Search.tsx @@ -114,13 +114,13 @@ function SearchInput() { ); } -function HighlightQuery({ text, query }: { text: string; query: string }) { +function HighlightQuery(props: { text: string; query: string }) { return ( ); }