"use client" import Link from "next/link" import { usePathname } from "next/navigation" import { ArrowRightIcon } from "@radix-ui/react-icons" import { cn } from "@/lib/utils" import { ScrollArea, ScrollBar } from "@/registry/default/ui/scroll-area" const examples = [ { name: "Authentication", href: "/examples/authentication", code: "https://github.com/turbo-eth/buidl/tree/main/apps/www/app/examples/authentication", }, ] interface ExamplesNavProps extends React.HTMLAttributes {} export function ExamplesNav({ className, ...props }: ExamplesNavProps) { const pathname = usePathname() return (
{examples.map((example) => ( {example.name} ))}
) } interface ExampleCodeLinkProps { pathname: string | null } export function ExampleCodeLink({ pathname }: ExampleCodeLinkProps) { const example = examples.find((example) => pathname?.startsWith(example.href)) if (!example?.code) { return null } return ( View code ) }