diff --git a/src/components/home/StatsSection.tsx b/src/components/home/StatsSection.tsx index 5d287828..25ad50ea 100644 --- a/src/components/home/StatsSection.tsx +++ b/src/components/home/StatsSection.tsx @@ -1,13 +1,51 @@ +import { useEffect, useState } from 'react'; import { motion } from 'framer-motion'; import { Users, Wrench, Star } from 'lucide-react'; -const stats = [ - { label: 'Active Users', value: '50K+', icon: Users }, - { label: 'Security Tools', value: '600+', icon: Wrench }, - { label: 'GitHub Stars', value: '15K+', icon: Star }, -]; +// Define a new type for the stats +interface Stat { + label: string; + value: string; + icon: React.ElementType; +} export function StatsSection() { + // Set initial state for the stats + const [stats, setStats] = useState([ + { label: 'Active Users', value: 'Loading...', icon: Users }, + { label: 'Security Tools', value: 'Loading...', icon: Wrench }, + { label: 'GitHub Stars', value: 'Loading...', icon: Star }, + ]); + + // Function to fetch stats from GitHub API + const fetchGitHubStats = async (username: string) => { + try { + const response = await fetch(`https://api.github.com/users/${username}`); + const userData = await response.json(); + + // Fetch repositories to count the stars + const reposResponse = await fetch(userData.repos_url); + const reposData = await reposResponse.json(); + + const starsCount = reposData.reduce((acc: number, repo: any) => acc + repo.stargazers_count, 0); + + // Set the state with the fetched stats + setStats([ + { label: ' ', value: `${userData.followers} Followers`, icon: Users }, + { label: ' ', value: `${reposData.length} Repositories`, icon: Wrench }, + { label: ' ', value: `${starsCount} Stars`, icon: Star }, + ]); + } catch (error) { + console.error('Error fetching GitHub data:', error); + } + }; + + // Fetch stats when the component is mounted + useEffect(() => { + const username = 'Snigdha-OS'; // Replace with the desired GitHub username + fetchGitHubStats(username); + }, []); + return (
@@ -38,4 +76,4 @@ export function StatsSection() {
); -} \ No newline at end of file +} diff --git a/src/components/home/TestimonialCard.tsx b/src/components/home/TestimonialCard.tsx index 4ffed51c..d7503a69 100644 --- a/src/components/home/TestimonialCard.tsx +++ b/src/components/home/TestimonialCard.tsx @@ -13,15 +13,16 @@ export function TestimonialCard({ content, author, role, delay = 0 }: Testimonia - -

{content}

+ +

{content}

-

{author}

+

{author}

{role}

); -} \ No newline at end of file +} diff --git a/src/components/home/ToolsShowcase.tsx b/src/components/home/ToolsShowcase.tsx index f8797bb4..5fec925c 100644 --- a/src/components/home/ToolsShowcase.tsx +++ b/src/components/home/ToolsShowcase.tsx @@ -27,10 +27,13 @@ export function ToolsShowcase() { key={tool.name} initial={{ opacity: 0, y: 20 }} whileInView={{ opacity: 1, y: 0 }} - transition={{ delay: index * 0.1 }} - className="flex flex-col items-center p-6 bg-white rounded-lg shadow-sm hover:shadow-md transition-shadow" + transition={{ delay: index * 0.1, duration: 0.5 }} + whileHover={{ scale: 1.05, boxShadow: "0 10px 20px rgba(0, 0, 0, 0.1)" }} + className="flex flex-col items-center p-6 bg-white rounded-xl shadow-lg hover:shadow-2xl transition-transform duration-300 ease-in-out" > - +
+ +

{tool.name}

))} @@ -38,4 +41,4 @@ export function ToolsShowcase() { ); -} \ No newline at end of file +}