feat: add StatsBar with animated counters, update page layout

This commit is contained in:
MBO-Tech-IT 2026-04-02 01:26:35 +02:00
parent 561b61f6b6
commit ed5136b9a1
2 changed files with 77 additions and 1 deletions

View File

@ -1,9 +1,11 @@
import Header from "@/components/Header";
import Hero from "@/components/Hero";
import TaglineBanner from "@/components/TaglineBanner";
import StatsBar from "@/components/StatsBar";
import Services from "@/components/Services";
import Technologies from "@/components/Technologies";
import DataSovereignty from "@/components/DataSovereignty";
import PaperlessSection from "@/components/PaperlessSection";
import About from "@/components/About";
import Contact from "@/components/Contact";
import Footer from "@/components/Footer";
@ -14,11 +16,13 @@ export default function Home() {
<Header />
<Hero />
<TaglineBanner />
<StatsBar />
<Services />
<TaglineBanner />
<Technologies />
<PaperlessSection />
<DataSovereignty />
<TaglineBanner />
<Technologies />
<About />
<TaglineBanner />
<Contact />

72
components/StatsBar.tsx Normal file
View File

@ -0,0 +1,72 @@
// components/StatsBar.tsx
"use client";
import { useEffect, useRef, useState } from "react";
const stats = [
{ value: 30, suffix: "+", label: "Jahre IT-Erfahrung", accent: "orange" },
{ value: 99, suffix: "%", label: "Server-Uptime", accent: "blue" },
{ value: 50, suffix: "+", label: "Abgeschlossene Projekte", accent: "orange" },
{ value: 24, suffix: "h", label: "Support-Reaktionszeit", accent: "blue" },
];
function Counter({ value, suffix, accent }: { value: number; suffix: string; accent: string }) {
const [count, setCount] = useState(0);
const ref = useRef<HTMLSpanElement>(null);
const started = useRef(false);
useEffect(() => {
const el = ref.current;
if (!el) return;
const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting && !started.current) {
started.current = true;
const duration = 1500;
const start = performance.now();
const tick = (now: number) => {
const progress = Math.min((now - start) / duration, 1);
const eased = 1 - Math.pow(1 - progress, 3);
setCount(Math.floor(eased * value));
if (progress < 1) requestAnimationFrame(tick);
};
requestAnimationFrame(tick);
observer.disconnect();
}
},
{ threshold: 0.3 }
);
observer.observe(el);
return () => observer.disconnect();
}, [value]);
const color = accent === "orange" ? "text-orange-400" : "text-blue-400";
return (
<span ref={ref} className={`text-4xl sm:text-5xl font-black ${color}`}>
{count}{suffix}
</span>
);
}
export default function StatsBar() {
return (
<section className="py-12 px-4 sm:px-6 lg:px-8 relative">
<div className="absolute inset-0 bg-[#111925]" />
<div className="max-w-7xl mx-auto relative">
<div className="grid grid-cols-2 lg:grid-cols-4 gap-8">
{stats.map((stat) => (
<div key={stat.label} className="text-center">
<Counter value={stat.value} suffix={stat.suffix} accent={stat.accent} />
<p className="text-slate-500 text-sm mt-1">{stat.label}</p>
</div>
))}
</div>
</div>
</section>
);
}