github
ui · paidGitHub drawn from its facts, no API at render: repo, issue, comment, profile
npx shadcn add @ag/githubA paid item: its source installs with a licence key, kept in .env.local as AG_LICENCE_KEY and sent from components.json. The source stays in your project and out of any public repository. The licence
{
"registries": {
"@ag": {
"url": "https://ui.adriangalilea.com/r/{name}.json",
"headers": { "Authorization": "Bearer ${AG_LICENCE_KEY}" }
}
}
}Already installed? Preview an update
npx shadcn add @ag/github --dry-runYour installed source stays unchanged until you update it. How updates work
- Fix: GitHub's dark colours (links, states, labels, the calendar's greens, code) follow the nearest scheme, the surface's or the page's, as every face's dark half does (
scheme-dark:). They followed only the page's theme class, so a card on a dark surface of a light page drew its light colours.
the demo above, verbatim
"use client"
import { Sample } from "@/app/samples"
import type {
GithubComment,
GithubProfile,
GithubRepo,
GithubThread,
} from "@/registry/base-nova/lib/github-data"
import { Github } from "@/registry/base-nova/ui/github"
// #region facts
/** Facts as data, written by `mise github <url>` for five real URLs. Nothing here
* fetched; the calendar alone is a year of days, so it lives in a file. */
import FACTS from "./github.demo.json"
const ISSUE = FACTS.issue as GithubThread
const COMMENT = FACTS.comment as GithubComment
const LONG = FACTS.long as GithubComment
const PR = FACTS.pr as GithubThread
const REPO = FACTS.repo as GithubRepo
const PROFILE = FACTS.profile as GithubProfile
// #endregion
export default function Demo() {
return (
<div className="space-y-16">
<Sample
name="comment"
with="facts"
title="01 · a comment"
description="one reply in its thread, the thread on a line above it, GitHub's own rendering of the markdown"
>
<Github facts={COMMENT} className="mx-auto max-w-2xl" />
</Sample>
<Sample
name="cut"
title="02 · cut"
description="lines={14} on a long comment and a short one: the long stops at fourteen lines with the rest a link away, the short never reaches the cut and shows whole"
>
<div className="mx-auto max-w-2xl space-y-6">
<Github facts={LONG} lines={14} />
<Github facts={COMMENT} lines={14} />
</div>
</Sample>
<Sample
name="threads"
glance="large"
title="03 · an issue and a pull request"
description="state in GitHub's colours, labels in their own, reactions, the size of the change and commits={3}"
>
<div className="mx-auto grid max-w-4xl items-start gap-6 md:grid-cols-2">
<Github facts={ISSUE} />
<Github facts={PR} commits={3} />
</div>
</Sample>
<Sample
name="repo"
title="04 · a repository"
description="the pinned card: description, language, stars, forks, and commits={3} from the default branch"
>
<Github facts={REPO} commits={3} className="mx-auto max-w-xl" />
</Sample>
<Sample
name="profile"
title="05 · a profile"
description="the person and the last year of contributions; hover a day for its count"
>
<Github facts={PROFILE} className="mx-auto max-w-3xl" />
</Sample>
<p className="max-w-prose text-foreground/60 text-sm">
Every card is a pure function of its facts and opens its place on
GitHub. Fetching them is <code>github-data</code>'s job, once, with
the author's own token: no API and no token on the page.
</p>
</div>
)
}