@@ -18,6 +23,7 @@ export default function FrenchSectionLayout({
diff --git a/app/learn/french/SectionNav.tsx b/app/learn/french/SectionNav.tsx new file mode 100644 index 0000000..626d457 --- /dev/null +++ b/app/learn/french/SectionNav.tsx @@ -0,0 +1,45 @@ + + +"use client"; + +import Link from "next/link"; +import { usePathname } from "next/navigation"; +import type { SectionSummary } from "@/app/learn/content"; + +export default function SectionNav({ + sections, +}: { + sections: SectionSummary[]; +}) { + const pathname = usePathname(); + const currentSlug = pathname.split("/").pop(); + + const currentIndex = sections.findIndex( + (section) => section.sectionSlug === currentSlug + ); + + const prevSection = currentIndex > 0 ? sections[currentIndex - 1] : null; + const nextSection = + currentIndex >= 0 && currentIndex < sections.length - 1 + ? sections[currentIndex + 1] + : null; + + return ( +
@@ -18,6 +23,7 @@ export default function FrenchSectionLayout({