diff --git a/apps/fronted/src/app/globals.css b/apps/fronted/src/app/globals.css index 29273c5..4221efe 100644 --- a/apps/fronted/src/app/globals.css +++ b/apps/fronted/src/app/globals.css @@ -185,6 +185,18 @@ } } +@keyframes gradient-xy { + 0% { + background-position: 0% 50%; + } + 50% { + background-position: 100% 50%; + } + 100% { + background-position: 0% 50%; + } +} + .animate-blob { animation: blob 7s infinite; } @@ -193,6 +205,10 @@ animation: tilt 10s infinite linear; } +.animate-gradient-xy { + animation: gradient-xy 15s ease infinite; +} + .animation-delay-2000 { animation-delay: 2s; } diff --git a/apps/fronted/src/components/home/Header.tsx b/apps/fronted/src/components/home/Header.tsx index b1dc0b0..25124fb 100644 --- a/apps/fronted/src/components/home/Header.tsx +++ b/apps/fronted/src/components/home/Header.tsx @@ -5,7 +5,7 @@ import { motion } from "framer-motion"; import { useTranslations } from "next-intl"; import Logo from "@/components/shared/Logo"; import ThemeToggle from "@/components/shared/ThemeToggle"; -import GitHubStars from "@/components/shared/GitHubStars"; +import { GitHubStars } from "@/components/shared/GitHubStars"; import LanguageSwitch from "../shared/LanguageSwitch"; import GoDashboard from "./GoDashboard"; import { Button } from "../ui/button"; diff --git a/apps/fronted/src/components/shared/GitHubStars.tsx b/apps/fronted/src/components/shared/GitHubStars.tsx index 23667a5..d34141e 100644 --- a/apps/fronted/src/components/shared/GitHubStars.tsx +++ b/apps/fronted/src/components/shared/GitHubStars.tsx @@ -1,57 +1,98 @@ "use client"; -import { JSX, SVGProps, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; +import { Star } from "lucide-react"; import { motion } from "framer-motion"; +import { cn } from "@/lib/utils"; -interface GitHubRepo { - stargazers_count: number; -} +const REPO_URL = "https://github.com/JOYCEQL/magic-resume"; +const API_URL = "https://api.github.com/repos/JOYCEQL/magic-resume"; -const Icons = { - gitHub: (props: JSX.IntrinsicAttributes & SVGProps) => ( - - - - ), -}; - -export default function GitHubStars() { - const [stars, setStars] = useState("--"); +export function GitHubStars() { + const [stars, setStars] = useState(null); + const [isHovered, setIsHovered] = useState(false); useEffect(() => { - async function fetchStars() { - try { - const response = await fetch( - "https://api.github.com/repos/JOYCEQL/magic-resume" - ); - const data: GitHubRepo = await response.json(); - const count = data.stargazers_count; - setStars( - count >= 1000 ? `${(count / 1000).toFixed(1)}k` : count.toString() - ); - } catch (error) { - console.error("Failed to fetch GitHub stars:", error); - } - } - - fetchStars(); + fetch(API_URL) + .then((res) => res.json()) + .then((data) => { + setStars(data.stargazers_count); + }) + .catch((error) => { + console.error("Error fetching GitHub stars:", error); + }); }, []); return ( setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} + whileHover={{ scale: 1.02 }} + whileTap={{ scale: 0.98 }} + initial={{ opacity: 0, y: 20 }} + animate={{ opacity: 1, y: 0 }} + transition={{ duration: 0.3 }} > -
- -
-
{stars}
+
+ + + + + + Star on GitHub + + {stars !== null && ( + <> + + + {stars.toLocaleString()} + + + )} ); }