Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

feat: add github link to repo

Dillion Verma69b861083577
diff --git a/components/site-header.tsx b/components/site-header.tsx
index 52e8b7fc..ea26c15b 100644
--- a/components/site-header.tsx
+++ b/components/site-header.tsx
@@ -1,15 +1,38 @@
import { CommandMenu } from "@/components/command-menu";
+import { Icons } from "@/components/icons";
import { MainNav } from "@/components/main-nav";
import { MobileNav } from "@/components/mobile-nav";
import { ModeToggle } from "@/components/mode-toggle";
+import { buttonVariants } from "@/components/ui/button";
+import { siteConfig } from "@/config/site";
import { cn } from "@/lib/utils";
+import NumberTicker from "@/registry/components/magicui/number-ticker";
+import { StarIcon } from "@heroicons/react/24/solid";
import { User } from "next-auth";
+import Link from "next/link";
interface SiteHeaderProps {
user?: User;
}
-export function SiteHeader({ user }: SiteHeaderProps) {
+export async function SiteHeader({ user }: SiteHeaderProps) {
+ const { stargazers_count: stars } = await fetch(
+ "https://api.github.com/repos/magicuidesign/magicui",
+ {
+ ...(process.env.GITHUB_OAUTH_TOKEN && {
+ headers: {
+ Authorization: `Bearer ${process.env.GITHUB_OAUTH_TOKEN}`,
+ "Content-Type": "application/json",
+ },
+ }),
+ next: {
+ revalidate: 3600,
+ },
+ },
+ )
+ .then((res) => res.json())
+ .catch(() => ({ stargazers_count: 300 }));
+
return (
<header
className={cn(
@@ -20,6 +43,26 @@ export function SiteHeader({ user }: SiteHeaderProps) {
<MainNav />
<MobileNav />
<div className="flex flex-1 items-center justify-between gap-2 md:justify-end">
+ <Link
+ className={cn(
+ buttonVariants(),
+ "hidden max-w-64 gap-2 overflow-hidden whitespace-pre md:flex",
+ "group relative w-full justify-center gap-2 rounded-full transition-all duration-300 ease-out hover:ring-2 hover:ring-primary hover:ring-offset-2",
+ )}
+ target="_blank"
+ href={siteConfig.links.github}
+ >
+ <span className="absolute right-0 -mt-12 h-32 w-8 translate-x-12 rotate-12 transform bg-white opacity-10 transition-all duration-1000 ease-out group-hover:-translate-x-40" />
+ <Icons.gitHub className="h-4 w-4" />
+ Star on GitHub
+ <div className="hidden items-center gap-1 text-sm text-gray-500 md:flex">
+ <StarIcon className="h-4 w-4 transition-all duration-300 group-hover:text-yellow-300" />
+ <NumberTicker
+ value={stars}
+ className="font-display font-medium text-white"
+ />
+ </div>
+ </Link>
<div className="w-full flex-1 md:w-auto md:flex-none">
<CommandMenu />
</div>
diff --git a/config/site.ts b/config/site.ts
index 7228233a..31b2274f 100644
--- a/config/site.ts
+++ b/config/site.ts
@@ -7,6 +7,7 @@ export const siteConfig = {
links: {
twitter: "https://twitter.com/magicuidesign",
discord: "https://discord.gg/87p2vpsat5",
+ github: "https://github.com/magicuidesign/magicui",
},
keywords: [
"React",
diff --git a/package.json b/package.json
index f7c278cf..a2d1b13a 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"@auth/prisma-adapter": "^1.0.0",
"@fontsource/inter": "^5.0.15",
"@headlessui/react": "^1.7.17",
+ "@heroicons/react": "^2.1.3",
"@hookform/resolvers": "^3.1.1",
"@next-auth/prisma-adapter": "^1.0.7",
"@prisma/client": "^5.11.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e0831203..a4f18dae 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -17,6 +17,9 @@ importers:
'@headlessui/react':
specifier: ^1.7.17
+ '@heroicons/react':
+ specifier: ^2.1.3
+ version: 2.1.3([email protected])
'@hookform/resolvers':
specifier: ^3.1.1
@@ -1465,6 +1468,11 @@ packages:
react: ^16 || ^17 || ^18
react-dom: ^16 || ^17 || ^18
+ '@heroicons/[email protected]':
+ resolution: {integrity: sha512-fEcPfo4oN345SoqdlCDdSa4ivjaKbk0jTd+oubcgNxnNgAfzysfwWfQUr+51wigiWHQQRiZNd1Ao0M5Y3M2EGg==}
+ peerDependencies:
+ react: '>= 16'
+
'@hookform/[email protected]':
resolution: {integrity: sha512-o5cgpGOuJYrd+iMKvkttOclgwRW86EsWJZZRC23prf0uU2i48Htq4PuT73AVb9ionFyZrwYEITuOFGF+BydEtQ==}
peerDependencies:
@@ -8471,6 +8479,10 @@ snapshots:
react: 18.2.0
react-dom: 18.2.0([email protected])
+ dependencies:
+ react: 18.2.0
+
dependencies:
react-hook-form: 7.50.1([email protected])