Migrates the docs site from remote-config-server to this repo as a standalone static Next.js app. Key changes: - Copy app-docs from remote-config-server to docs-site/ - Configure `output: 'export'` for static HTML generation - Replace API routes with build-time scripts (search index, image copy) - Add generateStaticParams() to enumerate all doc slugs at build time - Convert server-side redirects to client-side redirects - Point DOCS_DIR to sibling ../docs directory - Add GitHub Actions workflow for deploying to GitHub Pages - Add missing Radix UI dependencies (accordion, tabs) to package.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
956 B
TypeScript
28 lines
956 B
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import { Check, Copy } from "lucide-react";
|
|
|
|
export function CopyPageButton({ slug }: { slug: string }) {
|
|
const [copied, setCopied] = useState(false);
|
|
|
|
const handleCopy = async () => {
|
|
// Copy the visible page content
|
|
const content = document.querySelector(".docs-content");
|
|
if (content) {
|
|
await navigator.clipboard.writeText(content.textContent || "");
|
|
setCopied(true);
|
|
setTimeout(() => setCopied(false), 2000);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<button
|
|
onClick={handleCopy}
|
|
className="flex items-center gap-1.5 px-2 py-1 text-[13px] whitespace-nowrap rounded-md text-black/35 hover:text-black/60 dark:text-white/35 dark:hover:text-white/60 hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors"
|
|
>
|
|
{copied ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
|
|
<span>{copied ? "Copied" : "Copy page"}</span>
|
|
</button>
|
|
);
|
|
}
|