Skip to content

Commit 00380da

Browse files
authored
Merge pull request #427 from birobirobiro/new-sponsor
feat: add sponsors and improve header with GitHub stars
2 parents f721a06 + 7ffde40 commit 00380da

17 files changed

+420
-352
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<a href="https://shadcnstudio.com/?utm_source=awesome-shadcn-ui&utm_medium=banner&utm_campaign=github" target="_blank">
1818
<img src="public/sponsors/shadcnstudio.svg" alt="shadcnstudio.com" width="32">
1919
</a>
20+
<a href="https://www.shadcnblocks.com" target="_blank">
21+
<img src="public/sponsors/shadcnblocks.svg" alt="shadcnblocks.com" width="32">
22+
</a>
2023
</p>
2124

2225
<p align="center">

public/BuyMyACoffee.svg

Lines changed: 0 additions & 52 deletions
This file was deleted.

public/logo-mobile.svg

Lines changed: 15 additions & 0 deletions
Loading

public/sponsors/shadcnblocks.svg

Lines changed: 8 additions & 0 deletions
Loading

src/app/layout.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Header } from "@/components/layout/header";
33
import { Providers } from "@/providers/providers";
44
import { type Metadata, type Viewport } from "next";
55
import { GoogleAnalytics } from "@next/third-parties/google";
6+
import { TooltipProvider } from "@/components/ui/tooltip";
67

78
import type React from "react";
89
import { Suspense } from "react";
@@ -94,13 +95,15 @@ export default function RootLayout({
9495
>
9596
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_ID || ""} />
9697
<Providers>
97-
<Suspense>
98-
<div className="relative flex min-h-screen flex-col">
99-
<Header />
100-
<main className="flex-1">{children}</main>
101-
<Footer />
102-
</div>
103-
</Suspense>
98+
<TooltipProvider>
99+
<Suspense>
100+
<div className="relative flex min-h-screen flex-col">
101+
<Header />
102+
<main className="flex-1">{children}</main>
103+
<Footer />
104+
</div>
105+
</Suspense>
106+
</TooltipProvider>
104107
</Providers>
105108
</body>
106109
</html>

src/components/github-stars.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use client";
2+
3+
import { Octokit } from "@octokit/rest";
4+
import { useEffect, useState } from "react";
5+
6+
async function getStars() {
7+
const octokit = new Octokit();
8+
const { data } = await octokit.repos.get({
9+
owner: "birobirobiro",
10+
repo: "awesome-shadcn-ui",
11+
});
12+
return data.stargazers_count;
13+
}
14+
15+
export function GithubStars() {
16+
const [stars, setStars] = useState<number | null>(null);
17+
18+
useEffect(() => {
19+
getStars().then(setStars);
20+
}, []);
21+
22+
if (stars === null) return null;
23+
24+
const formattedStars =
25+
stars >= 1000 ? `${(stars / 1000).toFixed(1)}k` : stars;
26+
27+
return <span className="text-sm">{formattedStars}</span>;
28+
}

src/components/layout/footer.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { motion, useInView } from "motion/react";
88
import Link from "next/link";
99
import { useRef } from "react";
1010
import { Button } from "../ui/button";
11+
import { GithubStars } from "@/components/github-stars";
1112

1213
export function Footer() {
1314
const { categories } = useCategories();
@@ -137,7 +138,7 @@ export function Footer() {
137138
<motion.div variants={itemVariants}>
138139
<h4 className="font-semibold mb-4">Connect</h4>
139140
<div className="space-y-4">
140-
<div className="flex gap-3">
141+
<div className="flex gap-3 items-center">
141142
{socialLinks.map((social) => (
142143
<div key={social.name} className="flex items-center gap-2">
143144
<Button variant="outline" size="icon" asChild>
@@ -149,16 +150,13 @@ export function Footer() {
149150
<social.icon className="h-5 w-5 text-muted-foreground group-hover:text-foreground transition-colors" />
150151
</a>
151152
</Button>
152-
<span className="text-xs text-muted-foreground">
153-
{social.name}
154-
</span>
153+
<GithubStars />
155154
</div>
156155
))}
157156
</div>
158157

159158
<div className="flex items-center gap-2">
160159
<ThemeSwitcher />
161-
<span className="text-xs text-muted-foreground">Theme</span>
162160
</div>
163161
</div>
164162
</motion.div>

0 commit comments

Comments
 (0)