Files
Will Garman ed8868d940 fix: correct "Edit this page on GitHub" links for components and examples (#389)
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>
2026-03-06 09:32:44 -08:00

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>
);
};