mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-02-09 02:49:29 +08:00
* feat: init * fix * fix * fix * feat * feat * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: implement icons * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: update init command * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: dialog * feat * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: add registry:base item type * feat: rename frame to canva * fix * feat * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fi * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: add all colors * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: add outfit font * fix * fix * fix * fix * fix * chore: changeset * fix * fix * fix * fix * fix * fix * fix * fix
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import * as React from "react"
|
|
import Link from "next/link"
|
|
|
|
import { siteConfig } from "@/lib/config"
|
|
import { Icons } from "@/components/icons"
|
|
import { Button } from "@/registry/new-york-v4/ui/button"
|
|
import { Skeleton } from "@/registry/new-york-v4/ui/skeleton"
|
|
|
|
export function GitHubLink() {
|
|
return (
|
|
<Button asChild size="sm" variant="ghost" className="h-8 shadow-none">
|
|
<Link href={siteConfig.links.github} target="_blank" rel="noreferrer">
|
|
<Icons.gitHub />
|
|
<React.Suspense fallback={<Skeleton className="h-4 w-[42px]" />}>
|
|
<StarsCount />
|
|
</React.Suspense>
|
|
</Link>
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
export async function StarsCount() {
|
|
const data = await fetch("https://api.github.com/repos/shadcn-ui/ui", {
|
|
next: { revalidate: 86400 },
|
|
})
|
|
const json = await data.json()
|
|
|
|
const formattedCount =
|
|
json.stargazers_count >= 1000
|
|
? `${Math.round(json.stargazers_count / 1000)}k`
|
|
: json.stargazers_count.toLocaleString()
|
|
|
|
return (
|
|
<span className="text-muted-foreground w-fit text-xs tabular-nums">
|
|
{formattedCount}
|
|
</span>
|
|
)
|
|
}
|