forked from magicuidesign/magicui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add contributing links to sidebar (magicuidesign#202)
* feat: add contributing links to sidebar * fix: add documentation template * fix: lint * fix: bump node version for gh actions
- Loading branch information
1 parent
fc2f3f8
commit b4bd4d7
Showing
10 changed files
with
274 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Documentation | ||
about: Suggest an edit for the documentation | ||
title: "" | ||
labels: "" | ||
assignees: "" | ||
--- | ||
|
||
**Describe the documentation change** | ||
A clear and concise description of what you'd like to see changed or added in the documentation. | ||
|
||
**Current documentation** | ||
If applicable, provide a link or reference to the current documentation that needs to be updated. | ||
|
||
**Proposed change** | ||
Describe the change you'd like to see in the documentation. Be as specific as possible. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the documentation request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import Link from "next/link"; | ||
import { Doc } from "contentlayer/generated"; | ||
import { BugIcon, LightbulbIcon, PencilIcon } from "lucide-react"; | ||
|
||
import { getGitHubIssueUrl } from "@/lib/github"; | ||
|
||
export function Contribute({ doc }: { doc: Doc }) { | ||
const contributeLinks = [ | ||
{ | ||
text: "Report an issue", | ||
icon: BugIcon, | ||
href: getGitHubIssueUrl({ | ||
owner: "magicuidesign", | ||
repo: "magicui", | ||
title: `[bug]: ${doc.slug}`, | ||
labels: ["bug", "documentation"], | ||
template: "bug_report.md", | ||
}), | ||
}, | ||
{ | ||
text: "Request a feature", | ||
icon: LightbulbIcon, | ||
href: getGitHubIssueUrl({ | ||
owner: "magicuidesign", | ||
repo: "magicui", | ||
title: `[feat]: ${doc.slug}`, | ||
labels: ["enhancement"], | ||
template: "feature_request.md", | ||
}), | ||
}, | ||
{ | ||
text: "Edit this page", | ||
icon: PencilIcon, | ||
href: getGitHubIssueUrl({ | ||
owner: "magicuidesign", | ||
repo: "magicui", | ||
title: `[docs]: ${doc.slug}`, | ||
labels: ["documentation"], | ||
template: "documentation.md", | ||
}), | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className="space-y-2"> | ||
<p className="font-medium">Contribute</p> | ||
<ul className="m-0 list-none"> | ||
{contributeLinks.map((link, index) => ( | ||
<li key={index} className="mt-0 pt-2"> | ||
<Link | ||
href={link.href} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="inline-flex items-center text-sm text-muted-foreground hover:text-foreground transition-colors" | ||
> | ||
<link.icon className="mr-2 size-4" /> | ||
{link.text} | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
interface GitHubIssueUrlParams { | ||
owner: string; | ||
repo: string; | ||
title?: string; | ||
body?: string; | ||
labels?: string[]; | ||
template?: string; | ||
projects?: string[]; | ||
assignees?: string[]; | ||
milestone?: string; | ||
} | ||
|
||
/** | ||
* Generates a GitHub issue URL with the provided parameters. | ||
* https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-url-query | ||
* | ||
* @param params - Parameters for the GitHub issue URL. | ||
* @param params.owner - The GitHub repository owner's username. | ||
* @param params.repo - The name of the GitHub repository. | ||
* @param params.title - Optional title of the issue. | ||
* @param params.body - Optional body content of the issue. | ||
* @param params.labels - Optional array of labels for the issue. | ||
* @param params.template - Optional template file name for the issue. | ||
* @param params.projects - Optional array of project names to associate with the issue. | ||
* @param params.assignees - Optional array of usernames to assign the issue to. | ||
* @param params.milestone - Optional milestone to associate with the issue. | ||
* @returns A string containing the generated GitHub issue URL. | ||
*/ | ||
export function getGitHubIssueUrl(params: GitHubIssueUrlParams): string { | ||
const { owner, repo, ...issueParams } = params; | ||
const baseUrl = `https://github.com/${owner}/${repo}/issues/new`; | ||
const urlParams = new URLSearchParams(); | ||
|
||
Object.entries(issueParams).forEach(([key, value]) => { | ||
if (Array.isArray(value)) { | ||
value.forEach((item) => urlParams.append(key, item)); | ||
} else if (value !== undefined) { | ||
urlParams.append(key, value.toString()); | ||
} | ||
}); | ||
|
||
return `${baseUrl}?${urlParams.toString()}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.