+
+ {props.dir === "next" ? "Suivant" : "Précédent"}
+
+
+
+
+ {pageCategory && (
+
+ {pageCategory.title}
+
+ )}
+ {props.title}
+
+
+
+
+
+ );
+}
+
+export function PrevNextLinks() {
+ const { urlPathname } = usePageContext();
+
+ const allLinks = navigation
+ .flatMap((section) => section.links)
+ .flatMap((link) => {
+ return link.subitems ? [link, ...link.subitems] : link;
+ });
+
+ const getNeighboringLinks = () => {
+ const linkIndex = allLinks.findIndex((link) => link.href === urlPathname);
+ if (linkIndex === -1) return [null, null];
+
+ const previousPage = allLinks[linkIndex - 1] || null;
+ let nextPage = allLinks[linkIndex + 1] || null;
+
+ if (nextPage?.href === urlPathname) {
+ nextPage = allLinks[linkIndex + 2] || null;
+ }
+
+ return [previousPage, nextPage];
+ };
+
+ const [previousPage, nextPage] = getNeighboringLinks();
+ if (!nextPage && !previousPage) return null;
+
+ return (
+