Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

`docs:` Update `Edit this page` href (#233)

Parth Parmar675a748e3094
diff --git a/components/contribute.tsx b/components/contribute.tsx
index 8b7adf35..40f792e2 100644
--- a/components/contribute.tsx
+++ b/components/contribute.tsx
@@ -2,7 +2,7 @@ import Link from "next/link";
import { Doc } from "contentlayer/generated";
import { BugIcon, LightbulbIcon, PencilIcon } from "lucide-react";
-import { getGitHubIssueUrl } from "@/lib/github";
+import { getGithubFileUrl, getGitHubIssueUrl } from "@/lib/github";
export function Contribute({ doc }: { doc: Doc }) {
const contributeLinks = [
@@ -31,13 +31,7 @@ export function Contribute({ doc }: { doc: Doc }) {
{
text: "Edit this page",
icon: PencilIcon,
- href: getGitHubIssueUrl({
- owner: "magicuidesign",
- repo: "magicui",
- title: `[docs]: ${doc.slug}`,
- labels: ["documentation"],
- template: "documentation.md",
- }),
+ href: getGithubFileUrl(doc.slug),
},
];
diff --git a/lib/github.ts b/lib/github.ts
index dcafac8b..280ab628 100644
--- a/lib/github.ts
+++ b/lib/github.ts
@@ -41,3 +41,7 @@ export function getGitHubIssueUrl(params: GitHubIssueUrlParams): string {
return `${baseUrl}?${urlParams.toString()}`;
}
+
+export function getGithubFileUrl(slug: string) {
+ return `https://github.com/magicuidesign/magicui/blob/main/content${slug === "/docs" ? "/docs/index" : slug}.mdx`;
+}