mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-05 20:15:31 -04:00
b2416ff0db
- Replace single `<ViewTransition>` wrapper in layout with `FadeTransition` and `DirectionalTransition` components applied per page - Add `components/page-transition.tsx` with reusable transition wrappers - Expand view transition CSS with named classes: fade, slide, nav-forward/back, morph, text-morph, scale — all driven by CSS custom property durations - Use React `<ViewTransition name=... share="text-morph">` for shared note title element between list and detail views - Wrap comments suspense boundary with enter/exit slide transitions - Add `persistent-nav` and `persistent-footer` view-transition-name groups to keep chrome static during navigation - Fix reduced-motion override to target delay and duration instead of `animation: none` - Add tracking-tight and letter-spacing tweaks to home page typography
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { usePathname, useSelectedLayoutSegment } from "next/navigation";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
const menuItems = [
|
|
{
|
|
text: "Notes",
|
|
href: "/notes",
|
|
},
|
|
{
|
|
text: "Projects",
|
|
href: "/projects",
|
|
},
|
|
] as const;
|
|
|
|
const Menu = () => {
|
|
const pathname = usePathname();
|
|
const segment = useSelectedLayoutSegment() || "";
|
|
|
|
return (
|
|
<nav data-slot="navigation-menu" className="flex items-center gap-2">
|
|
{menuItems.map((item) => {
|
|
const isCurrent = item.href?.split("/")[1] === segment;
|
|
const transitionTypes =
|
|
item.href === "/notes" && pathname.startsWith("/notes/")
|
|
? ["nav-back"]
|
|
: pathname === item.href
|
|
? undefined
|
|
: ["nav-lateral"];
|
|
|
|
return (
|
|
<Button
|
|
key={item.href}
|
|
variant="ghost"
|
|
size="sm"
|
|
nativeButton={false}
|
|
aria-label={item.text}
|
|
data-current={isCurrent || undefined}
|
|
className="data-current:bg-accent/60 data-current:text-accent-foreground text-sm leading-none"
|
|
render={<Link href={item.href} transitionTypes={transitionTypes} />}
|
|
>
|
|
{item.text}
|
|
</Button>
|
|
);
|
|
})}
|
|
</nav>
|
|
);
|
|
};
|
|
|
|
export { Menu };
|