Update src/components/sections/about/AboutMetric.tsx

This commit is contained in:
2026-02-27 12:56:31 +00:00
parent 3553bc5b85
commit f51a62b4a7

View File

@@ -34,15 +34,6 @@ export default function AboutMetric({
const bgClass = useInvertedBackground ? 'bg-slate-900' : 'bg-white'; const bgClass = useInvertedBackground ? 'bg-slate-900' : 'bg-white';
const textClass = useInvertedBackground ? 'text-white' : 'text-slate-900'; const textClass = useInvertedBackground ? 'text-white' : 'text-slate-900';
const getAnimationDelay = (index: number) => {
if (metricsAnimation === 'slide-up') {
return {
transitionDelay: `${index * 100}ms`,
};
}
return {};
};
return ( return (
<section className={`${bgClass} py-16 px-4 sm:px-6 lg:px-8`}> <section className={`${bgClass} py-16 px-4 sm:px-6 lg:px-8`}>
<div className="max-w-6xl mx-auto"> <div className="max-w-6xl mx-auto">
@@ -62,10 +53,11 @@ export default function AboutMetric({
key={index} key={index}
className="h-64 cursor-pointer perspective" className="h-64 cursor-pointer perspective"
onClick={() => toggleFlip(index)} onClick={() => toggleFlip(index)}
style={getAnimationDelay(index)}
> >
<div <div
className="relative w-full h-full transition-transform duration-500 transform-gpu" className={`relative w-full h-full transition-transform duration-500 transform-gpu ${
isFlipped ? '[transform:rotateY(180deg)]' : ''
}`}
style={{ style={{
transformStyle: 'preserve-3d', transformStyle: 'preserve-3d',
transform: isFlipped ? 'rotateY(180deg)' : 'rotateY(0deg)', transform: isFlipped ? 'rotateY(180deg)' : 'rotateY(0deg)',
@@ -73,36 +65,52 @@ export default function AboutMetric({
> >
{/* Front Side */} {/* Front Side */}
<div <div
className={`absolute w-full h-full ${bgClass} rounded-lg shadow-lg p-6 flex flex-col items-center justify-center border border-slate-200`} className={`absolute w-full h-full ${
style={{ useInvertedBackground ? 'bg-slate-800' : 'bg-slate-50'
backfaceVisibility: 'hidden', } rounded-lg shadow-lg p-6 flex flex-col items-center justify-center border ${
}} useInvertedBackground ? 'border-slate-700' : 'border-slate-200'
}`}
style={{ backfaceVisibility: 'hidden' }}
>
<Icon
className={`w-12 h-12 mb-4 ${
useInvertedBackground ? 'text-blue-400' : 'text-blue-600'
}`}
/>
<p
className={`text-sm font-medium ${
useInvertedBackground ? 'text-slate-300' : 'text-slate-600'
} text-center mb-2`}
> >
<Icon className={`w-12 h-12 ${useInvertedBackground ? 'text-blue-400' : 'text-blue-600'} mb-4`} />
<p className={`text-sm font-semibold ${textClass} text-center mb-2`}>
{metric.label} {metric.label}
</p> </p>
<p className={`text-3xl font-bold ${useInvertedBackground ? 'text-blue-400' : 'text-blue-600'}`}> <p
className={`text-3xl font-bold ${textClass} text-center`}
>
{metric.value} {metric.value}
</p> </p>
<p className={`text-xs ${useInvertedBackground ? 'text-slate-400' : 'text-slate-500'} mt-4 text-center`}> <p
Click to learn more className={`text-xs mt-4 ${
useInvertedBackground ? 'text-slate-400' : 'text-slate-500'
}`}
>
Click to flip
</p> </p>
</div> </div>
{/* Back Side */} {/* Back Side */}
<div <div
className={`absolute w-full h-full ${useInvertedBackground ? 'bg-slate-800' : 'bg-slate-100'} rounded-lg shadow-lg p-6 flex flex-col items-center justify-center border border-slate-200`} className={`absolute w-full h-full ${
useInvertedBackground ? 'bg-blue-600' : 'bg-blue-500'
} rounded-lg shadow-lg p-6 flex flex-col items-center justify-center`}
style={{ style={{
backfaceVisibility: 'hidden', backfaceVisibility: 'hidden',
transform: 'rotateY(180deg)', transform: 'rotateY(180deg)',
}} }}
> >
<p className={`text-sm ${textClass} text-center leading-relaxed`}> <p className="text-white text-center text-sm leading-relaxed">
{metric.label}: {metric.value} represents our commitment to excellence and continuous growth in this area. {metric.label}: {metric.value} represents our commitment to
</p> excellence and continuous growth in the tech community.
<p className={`text-xs ${useInvertedBackground ? 'text-slate-400' : 'text-slate-500'} mt-4 text-center`}>
Click to flip back
</p> </p>
</div> </div>
</div> </div>