@@ -5,6 +5,7 @@ import Link from "next/link";
55import React , { useEffect , useState } from "react" ;
66import { Logo } from "@/components/Logo" ;
77import { ThemeTogglerComponent } from "@/components/theme/theme-toggle" ;
8+ import { useGithubStars } from "@/hooks/use-github-stars" ;
89import { cn } from "@/lib/utils" ;
910
1011export const Navbar = ( ) => {
@@ -36,6 +37,7 @@ export const Navbar = () => {
3637
3738const DesktopNav = ( { navItems, isScrolled } : any ) => {
3839 const [ hovered , setHovered ] = useState < number | null > ( null ) ;
40+ const { compactFormat : githubStars , loading : loadingGithubStars } = useGithubStars ( ) ;
3941 return (
4042 < motion . div
4143 onMouseLeave = { ( ) => {
@@ -86,7 +88,13 @@ const DesktopNav = ({ navItems, isScrolled }: any) => {
8688 className = "hidden rounded-full px-3 py-2 hover:bg-gray-100 dark:hover:bg-neutral-800 transition-colors md:flex items-center gap-1.5"
8789 >
8890 < IconBrandGithub className = "h-5 w-5 text-neutral-600 dark:text-neutral-300" />
89- < span className = "text-sm font-medium text-neutral-600 dark:text-neutral-300" > 9.5k</ span >
91+ { loadingGithubStars ? (
92+ < div className = "w-6 h-5 dark:bg-neutral-800 animate-pulse" > </ div >
93+ ) : (
94+ < span className = "text-sm font-medium text-neutral-600 dark:text-neutral-300" >
95+ { githubStars }
96+ </ span >
97+ ) }
9098 </ Link >
9199 < ThemeTogglerComponent />
92100 < Link
@@ -102,6 +110,7 @@ const DesktopNav = ({ navItems, isScrolled }: any) => {
102110
103111const MobileNav = ( { navItems, isScrolled } : any ) => {
104112 const [ open , setOpen ] = useState ( false ) ;
113+ const { compactFormat : githubStars , loading : loadingGithubStars } = useGithubStars ( ) ;
105114
106115 return (
107116 < >
@@ -160,12 +169,19 @@ const MobileNav = ({ navItems, isScrolled }: any) => {
160169 className = "flex items-center gap-1.5 rounded-lg px-3 py-2 hover:bg-gray-100 dark:hover:bg-neutral-800 transition-colors"
161170 >
162171 < IconBrandGithub className = "h-5 w-5 text-neutral-600 dark:text-neutral-300" />
163- < span className = "text-sm font-medium text-neutral-600 dark:text-neutral-300" >
164- 9.5k
165- </ span >
172+ { loadingGithubStars ? (
173+ < div className = "w-6 h-5 dark:bg-neutral-800 animate-pulse" > </ div >
174+ ) : (
175+ < span className = "text-sm font-medium text-neutral-600 dark:text-neutral-300" >
176+ { githubStars }
177+ </ span >
178+ ) }
166179 </ Link >
167180 </ div >
168- < button className = "w-full rounded-lg bg-black px-8 py-2 font-medium text-white shadow-[0px_-2px_0px_0px_rgba(255,255,255,0.4)_inset] dark:bg-white dark:text-black" >
181+ < button
182+ type = "button"
183+ className = "w-full rounded-lg bg-black px-8 py-2 font-medium text-white shadow-[0px_-2px_0px_0px_rgba(255,255,255,0.4)_inset] dark:bg-white dark:text-black"
184+ >
169185 Book a call
170186 </ button >
171187 </ motion . div >
0 commit comments