mirror of
https://github.com/vercel/ai-elements.git
synced 2026-09-14 19:48:26 +08:00
ed8868d940
The EditSource component hardcoded `content/docs/` in the GitHub edit URL, causing 404s for component and example pages whose content lives under `content/components/` and `content/examples/` respectively. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
802 B
TypeScript
33 lines
802 B
TypeScript
import { SiGithub } from "@icons-pack/react-simple-icons";
|
|
|
|
import { github } from "@/geistdocs";
|
|
|
|
interface EditSourceProps {
|
|
path: string | undefined;
|
|
contentDir?: string;
|
|
}
|
|
|
|
export const EditSource = ({ path, contentDir = "docs" }: EditSourceProps) => {
|
|
let url: string | undefined;
|
|
|
|
if (github.owner && github.repo && path) {
|
|
url = `https://github.com/${github.owner}/${github.repo}/edit/main/apps/docs/content/${contentDir}/${path}`;
|
|
}
|
|
|
|
if (!url) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<a
|
|
className="flex items-center gap-1.5 text-muted-foreground text-sm transition-colors hover:text-foreground"
|
|
href={url}
|
|
rel="noopener noreferrer"
|
|
target="_blank"
|
|
>
|
|
<SiGithub className="size-3.5" />
|
|
<span>Edit this page on GitHub</span>
|
|
</a>
|
|
);
|
|
};
|