Skip to content

Commit

Permalink
feat: footer
Browse files Browse the repository at this point in the history
  • Loading branch information
airjp73 committed Jun 14, 2024
1 parent 9005d2d commit f1b5619
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/docs-v2/app/routes/_docs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link, Outlet } from "@remix-run/react";
import { motion } from "framer-motion";
import { Logo } from "~/ui/branding/Logo";
import { Footer } from "~/ui/layout/Footer";
import { Header } from "~/ui/layout/Header";
import { Navigation } from "~/ui/layout/Navigation";

Expand All @@ -26,6 +27,7 @@ export default function DocsLayout() {
<main className="flex-auto">
<Outlet />
</main>
<Footer />
</div>
</div>
</div>
Expand Down
58 changes: 58 additions & 0 deletions apps/docs-v2/app/ui/layout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"use client";

import { Link, useLocation } from "@remix-run/react";
import { navigation } from "./Navigation";
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";

const flatNavLinks = navigation.flatMap((item) => item.links);

function PageNavigation() {
const location = useLocation();

const currentPageIndex = flatNavLinks.findIndex(
(link) => link.href === location.pathname,
);
const prevPage = flatNavLinks[currentPageIndex - 1];
const nextPage = flatNavLinks[currentPageIndex + 1];

if (!prevPage && !nextPage) {
return null;
}

return (
<div className="flex border-t border-zinc-900/10 pt-8 dark:border-white/10">
{prevPage && (
<div className="flex flex-col items-end gap-3">
<Link
to={prevPage.href}
className="flex items-center gap-2"
prefetch="intent"
>
<ArrowLeftIcon className="h-4 w-4" />
<span>{prevPage.title}</span>
</Link>
</div>
)}
{nextPage && (
<div className="flex flex-col items-start gap-3 ml-auto">
<Link
to={nextPage.href}
className="flex items-center gap-2 ml-auto"
prefetch="intent"
>
<span>{nextPage.title}</span>
<ArrowRightIcon className="h-4 w-4" />
</Link>
</div>
)}
</div>
);
}

export function Footer() {
return (
<footer className="mx-auto w-full max-w-2xl space-y-10 pb-16 lg:max-w-5xl">
<PageNavigation />
</footer>
);
}
1 change: 1 addition & 0 deletions apps/docs-v2/app/ui/layout/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import clsx from "clsx";
import { AnimatePresence, motion } from "framer-motion";
import { cn } from "~/lib/utils";
import { useMobileNavigationStore } from "./MobileNavigation";
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";

interface NavGroup {
title: string;
Expand Down

0 comments on commit f1b5619

Please sign in to comment.