Skip to content

Commit 44764f3

Browse files
committed
fix: reuse breakDownGithubUrl for example card links
1 parent c346095 commit 44764f3

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

apps/www/components/docs/example-cards.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Card, Cards } from "fumadocs-ui/components/card";
22
import { getGithubRepoUrl } from "~/lib/github-links";
3+
import { breakDownGithubUrl } from "~/lib/utils/github";
34
import registry from "../../../../examples/registry.json";
45

56
type Example = {
@@ -12,11 +13,8 @@ type Example = {
1213
const examples = (registry as { examples: Example[] }).examples;
1314

1415
function exampleTreeUrl(id: string): string {
15-
const ref =
16-
process.env.VERCEL_GIT_COMMIT_REF ??
17-
process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF ??
18-
"main";
19-
return `${getGithubRepoUrl()}/tree/${encodeURIComponent(ref)}/examples/${id}`;
16+
const { defaultBranch } = breakDownGithubUrl();
17+
return `${getGithubRepoUrl()}/tree/${encodeURIComponent(defaultBranch)}/examples/${id}`;
2018
}
2119

2220
/**

0 commit comments

Comments
 (0)