From 52c964b3880bdfa599b45a8134b4aef1bb2b5c4e Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Mon, 14 Apr 2025 05:39:52 +0200 Subject: [PATCH] refactor: Remove unnecessary code imports and rearrange variable declarations --- app/components/syntax/PrevNextLinks.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/syntax/PrevNextLinks.tsx b/app/components/syntax/PrevNextLinks.tsx index 271f130..990613a 100644 --- a/app/components/syntax/PrevNextLinks.tsx +++ b/app/components/syntax/PrevNextLinks.tsx @@ -1,6 +1,6 @@ -import { navigation, NavigationLink, type NavigationSubItem } from "@/lib/navigation"; import { usePageContext } from "vike-react/usePageContext"; import { Link } from "@/components/common/Link"; +import { navigation } from "@/lib/navigation"; import clsx from "clsx"; function ArrowIcon(props: React.ComponentPropsWithoutRef<"svg">) { @@ -52,12 +52,13 @@ function PageLink({ } export function PrevNextLinks() { + const { urlPathname } = usePageContext(); + const allLinks = navigation .flatMap((section) => section.links) .flatMap((link) => { return link.subitems ? [link, ...link.subitems] : link; }); - const { urlPathname } = usePageContext(); const getNeighboringLinks = () => { const linkIndex = allLinks.findIndex((link) => link.href === urlPathname); @@ -70,7 +71,6 @@ export function PrevNextLinks() { }; const [previousPage, nextPage] = getNeighboringLinks(); - if (!nextPage && !previousPage) return null; return (