Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(www): add link to rule source on GitHub #1264

Merged
merged 1 commit into from
May 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions www/routes/rules/[name].tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import IconBrandGithub from "https://deno.land/x/[email protected]/tsx/brand-github.tsx";

import jsonData from "../../static/docs.json" with { type: "json" };

import { Handlers, PageProps } from "$fresh/server.ts";
Expand Down Expand Up @@ -26,6 +28,9 @@ export const handler: Handlers<RuleData> = {

export default function RulePage(props: PageProps) {
const rule: RuleData = props.data;
const ruleSlug = rule.code.replaceAll("-", "_");
const sourceLink =
`https://github.com/denoland/deno_lint/blob/main/src/rules/${ruleSlug}.rs`;

return (
<div>
Expand All @@ -42,6 +47,15 @@ export default function RulePage(props: PageProps) {
<main>
<Rule rule={rule} open />
</main>
<footer>
<a class="hover:underline" href={sourceLink}>
<IconBrandGithub
title="View rule source on GitHub"
class="w-5 h-5 mr-1 inline"
/>
Rule source
</a>
</footer>
</div>
);
}
Loading