mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
46fc5bbe9d
* docs: sync geistdocs template 1.2.0–1.2.3 + polish
- Ran @vercel/geistdocs@1.2.2 update --sync against origin/main
(already contains merged 1.2.3) for:
- components/geistdocs/*
- components/geistcn-fallbacks/**/* (new)
- components/ui/command-prompt.tsx, navigation-menu.tsx
- app/styles/geistdocs.css
- Manual overlays (paths skipped by sync due to chat customizations):
- app/[lang]/layout.tsx: drop scroll-smooth (1.2.2)
- app/[lang]/docs/[[...slug]]/page.tsx: MobileDocsBar + disable
default TOC popover (1.2.0)
- app/[lang]/docs/layout.tsx: wrap in bg-background-200 (1.2.3)
- components/ui/badge.tsx: secondary variant → bg-gray-300/text-gray-1000 (1.2.3)
- Home hero: replace Get Started + Installer with CommandPrompt
humans/agents switcher ("npm install chat" / "npx skills add vercel/chat")
- (home) layout: swap bg-sidebar dark:bg-background for bg-background-200
so /, /adapters, /resources share the navbar surface
- DesktopMenu: active-state detection with longest-prefix match
(so /docs/api highlights "API", not also "Docs")
- navbar-logo dropdown: drop Chat SDK self-entry
- New geist-fill icons (check-circle-fill, cross-circle-fill,
warning-fill) ported from @vercel/geistcn-assets; new
components/custom/status-icons.tsx registers Check/Cross/Warn MDX
components
- content/docs/adapters.mdx: replace ✅/❌/⚠️ emojis with the new
icons (emoji.mdx intentionally left alone)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: use LogoChatSdk from geistcn-fallbacks as the app Logo
Replace the inline Chat SDK wordmark SVG in geistdocs.tsx with
<LogoChatSdk /> so the navbar and other Logo consumers share the
same source of truth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: default hero CommandPrompt to humans tab
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
151 lines
4.0 KiB
TypeScript
151 lines
4.0 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { useEffect, useState } from "react";
|
|
import { IconArrowUpRight } from "@/components/geistcn-fallbacks/geistcn-assets/icons/icon-arrow-up-right";
|
|
import { nav } from "@/geistdocs";
|
|
import { cn } from "@/lib/utils";
|
|
import { SearchButton } from "./search";
|
|
|
|
function NavLink({
|
|
href,
|
|
external,
|
|
onClick,
|
|
children,
|
|
}: {
|
|
href: string;
|
|
external?: boolean;
|
|
onClick?: () => void;
|
|
children: React.ReactNode;
|
|
}) {
|
|
return (
|
|
<Link
|
|
className="group flex items-center justify-between rounded-md p-3 text-gray-900 transition-colors hover:bg-gray-100 hover:text-gray-1000"
|
|
href={href}
|
|
onClick={onClick}
|
|
rel={external ? "noopener" : undefined}
|
|
target={external ? "_blank" : undefined}
|
|
>
|
|
{children}
|
|
{external && (
|
|
<IconArrowUpRight
|
|
className="text-gray-900 group-hover:text-gray-1000"
|
|
size={16}
|
|
/>
|
|
)}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
function MobileMenuButton({
|
|
expanded,
|
|
onClick,
|
|
}: {
|
|
expanded: boolean;
|
|
onClick: () => void;
|
|
}) {
|
|
return (
|
|
<button
|
|
aria-expanded={expanded}
|
|
aria-label={expanded ? "Close menu" : "Open menu"}
|
|
className="relative flex size-8 items-center justify-center rounded-full border border-gray-200 transition-colors hover:bg-gray-100 lg:hidden"
|
|
onClick={onClick}
|
|
type="button"
|
|
>
|
|
<span className="flex flex-col items-center justify-center gap-[5px]">
|
|
<span
|
|
className={cn(
|
|
"block h-[1.5px] w-3.5 bg-gray-1000 transition-all duration-150",
|
|
expanded && "translate-y-[3.25px] rotate-45"
|
|
)}
|
|
/>
|
|
<span
|
|
className={cn(
|
|
"block h-[1.5px] w-3.5 bg-gray-1000 transition-all duration-150",
|
|
expanded && "-translate-y-[3.25px] -rotate-45"
|
|
)}
|
|
/>
|
|
</span>
|
|
</button>
|
|
);
|
|
}
|
|
|
|
export const MobileMenu = () => {
|
|
const [show, setShow] = useState(false);
|
|
|
|
// Close on route change
|
|
useEffect(() => {
|
|
setShow(false);
|
|
}, []);
|
|
|
|
// Close on escape
|
|
useEffect(() => {
|
|
const handleEscape = (e: KeyboardEvent) => {
|
|
if (e.key === "Escape" && show) {
|
|
setShow(false);
|
|
}
|
|
};
|
|
document.addEventListener("keydown", handleEscape);
|
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
}, [show]);
|
|
|
|
// Lock scroll when open
|
|
useEffect(() => {
|
|
document.body.style.overflow = show ? "hidden" : "";
|
|
return () => {
|
|
document.body.style.overflow = "";
|
|
};
|
|
}, [show]);
|
|
|
|
const close = () => setShow(false);
|
|
|
|
return (
|
|
<>
|
|
<MobileMenuButton expanded={show} onClick={() => setShow(!show)} />
|
|
|
|
{/* Backdrop */}
|
|
{/* biome-ignore lint/a11y/noNoninteractiveElementInteractions: backdrop dismiss */}
|
|
{/* biome-ignore lint/a11y/noStaticElementInteractions: backdrop dismiss */}
|
|
{/* biome-ignore lint/a11y/useKeyWithClickEvents: backdrop dismiss */}
|
|
<div
|
|
className={cn(
|
|
"fixed inset-0 top-16 z-40 bg-background-200 backdrop-blur-sm transition-opacity duration-200",
|
|
show
|
|
? "pointer-events-auto opacity-100"
|
|
: "pointer-events-none opacity-0"
|
|
)}
|
|
onClick={close}
|
|
/>
|
|
|
|
{/* Popover */}
|
|
<div
|
|
className={cn(
|
|
"fixed inset-x-0 top-16 bottom-0 z-40 overflow-y-auto bg-background-200 px-2 transition-all duration-200",
|
|
show
|
|
? "translate-y-0 opacity-100"
|
|
: "pointer-events-none -translate-y-2 opacity-0"
|
|
)}
|
|
>
|
|
{/* Search */}
|
|
<div className="p-4">
|
|
<SearchButton className="w-full" onClick={close} />
|
|
</div>
|
|
|
|
{/* Navigation */}
|
|
<nav className="px-1">
|
|
{nav.map(({ label, href }) => (
|
|
<NavLink
|
|
external={href.startsWith("http")}
|
|
href={href}
|
|
key={href}
|
|
onClick={close}
|
|
>
|
|
{label}
|
|
</NavLink>
|
|
))}
|
|
</nav>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|