mirror of
https://github.com/vercel/flags.git
synced 2026-09-19 03:49:23 +08:00
97c8060917
* Sync docs template with @vercel/geistdocs 1.2.0 + 1.2.1 Pulls in template updates via `@vercel/geistdocs@1.2.1 update --sync`: - 1.2.0: new NavbarLogo (oss product switcher variant), geist theme tokens + icons, updated docs layout, MobileDocsBar, redesigned navbar and mobile menu - 1.2.1: CommandPrompt UI component, IconCheck / IconCopy fallback icons, supporting CSS tokens and @utility rules (material-small, text-label-13, text-label-14-mono, text-label-16-mono, --ds-shadow-border-small light/dark) Home page intentionally left untouched because flags-sdk uses a custom home/[code] routing structure. package.json left untouched to preserve workspace/catalog references and app-specific deps (flags, @vercel/toolbar, newer Next). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Cap footer max-w and use LogoFlagsSdk in navbar - Cap the footer inner row at max-w-[1448px] so it aligns with the navbar on very wide screens - Render the Flags SDK wordmark (LogoFlagsSdk) directly in the navbar via the oss NavbarLogo trigger; drop the duplicate entry from the product switcher dropdown Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Use bg-background-200 for docs container Matches the navbar background so docs pages (principles, frameworks, providers, etc.) no longer sit on a lighter surface than the header. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Use CommandPrompt humans/agents switcher in hero CTA Replaces the Get Started button + CopySnippet in the home hero with the CommandPrompt switcher. Triggers and surface are aligned to the left via `items-start` on the root so they line up with the hero heading instead of being centered. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Use full npm install command in hero CommandPrompt Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Default hero CommandPrompt to the agents tab Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Bump navbar Flags SDK logo to height 22 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Use MobileDocsBar for docs mobile navigation Disables the default Fumadocs TOC popover and renders the MobileDocsBar (sidebar trigger + TOC sheet) above the docs title, matching the geistdocs template. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Override fumadocs primary at :root so prose links render gray-1000 Matches the workflow docs tweak — broadens the fd-primary override from #nd-toc to :root so in-content links pick up the design-system foreground color instead of the default blue. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Use new --ds-shadow-menu on hero "Try the Flags SDK" card - Update --ds-shadow-menu to the 4-layer geist menu shadow - Apply it to the flags-toggle card via `shadow-(--ds-shadow-menu)`; drop the stock `shadow-md` and redundant border Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Use LogoFlagsSdk as the app Logo; add AI SDK to product switcher - Replace the inline triangle SVG + "Flags SDK" text in geistdocs.tsx with `<LogoFlagsSdk height={22} />`, so navbar & template consumers get the real wordmark - Revert navbar.tsx to import `Logo` from `@/geistdocs` (single source of truth) — the direct LogoFlagsSdk import is no longer needed - Add `LogoAiSdk` to OSS_PRODUCT_LINKS at the top of the list (`ai-sdk.dev`) - Give LogoAiSdk the same `color` prop pattern as the other SDK logos - Formatter cleanup in app/[lang]/layout.tsx Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Restore FrameworkSwitcher and theme the Next.js icon - Re-mount <FrameworkSwitcher /> at the top of the desktop sidebar and the mobile Sheet (lost during the 1.2.x template sync) - Rewrite the Next.js icon to mirror LogoIconNextSvg from @vercel/geistcn-assets: circle uses currentColor + text-gray-1000 so it auto-inverts per theme; gradient stops for the "N" use var(--ds-background-100) so the highlight stays readable in light and dark Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Docs: active nav state, geist shadow, restored framework icon + TOC offset - DesktopMenu: mark nav items active when pathname falls under the item's section (match on first three path segments, ignore locale prefix); add `data-[active]:text-gray-1000` to the selector - CodeBlock: restore the `#next` / `#svelte` title-suffix parser so framework icons render in code block headers again - FrameworkSwitcher: apply `--ds-shadow-menu` to the popover content - geistdocs.css: push `#nd-toc` over with `md:pl-8` 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>
|
|
</>
|
|
);
|
|
};
|