189 lines
7.1 KiB
TypeScript
189 lines
7.1 KiB
TypeScript
'use client';
|
|
|
|
import { motion, useReducedMotion } from 'framer-motion';
|
|
import { useState } from 'react';
|
|
|
|
export default function TeamCompetitionMockup() {
|
|
const shouldReduceMotion = useReducedMotion();
|
|
const [hoveredDriver, setHoveredDriver] = useState<number | null>(null);
|
|
const [hoveredTeam, setHoveredTeam] = useState<number | null>(null);
|
|
|
|
const teamColors = ['#198CFF', '#6FE37A', '#FFC556', '#43C9E6', '#9333EA'];
|
|
|
|
const leftColumnVariants = {
|
|
hidden: { opacity: 0, x: shouldReduceMotion ? 0 : -20 },
|
|
visible: {
|
|
opacity: 1,
|
|
x: 0,
|
|
transition: {
|
|
type: 'spring' as const,
|
|
stiffness: 100,
|
|
damping: 20
|
|
}
|
|
}
|
|
};
|
|
|
|
const rightColumnVariants = {
|
|
hidden: { opacity: 0, x: shouldReduceMotion ? 0 : 20 },
|
|
visible: {
|
|
opacity: 1,
|
|
x: 0,
|
|
transition: {
|
|
type: 'spring' as const,
|
|
stiffness: 100,
|
|
damping: 20
|
|
}
|
|
}
|
|
};
|
|
|
|
const rowVariants = {
|
|
hidden: { opacity: 0, scale: shouldReduceMotion ? 1 : 0.95 },
|
|
visible: (i: number) => ({
|
|
opacity: 1,
|
|
scale: 1,
|
|
transition: {
|
|
delay: shouldReduceMotion ? 0 : 0.3 + i * 0.05,
|
|
type: 'spring' as const,
|
|
stiffness: 300,
|
|
damping: 25
|
|
}
|
|
})
|
|
};
|
|
|
|
return (
|
|
<div className="relative w-full h-full bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite rounded-lg p-6 overflow-hidden">
|
|
<div className="grid grid-cols-2 gap-6 h-full">
|
|
<motion.div
|
|
variants={leftColumnVariants}
|
|
initial="hidden"
|
|
animate="visible"
|
|
className="relative"
|
|
>
|
|
<div className="h-5 w-24 bg-white/10 rounded mb-4 text-xs flex items-center justify-center text-white font-semibold">
|
|
Drivers
|
|
</div>
|
|
<div className="space-y-2">
|
|
{[1, 2, 3, 4, 5].map((i) => (
|
|
<motion.div
|
|
key={i}
|
|
custom={i}
|
|
variants={rowVariants}
|
|
initial="hidden"
|
|
animate="visible"
|
|
className="relative flex items-center gap-3 bg-iron-gray rounded-lg p-2.5 border border-charcoal-outline overflow-hidden"
|
|
onHoverStart={() => !shouldReduceMotion && setHoveredDriver(i)}
|
|
onHoverEnd={() => setHoveredDriver(null)}
|
|
whileHover={shouldReduceMotion ? {} : {
|
|
scale: 1.02,
|
|
boxShadow: `0 0 20px ${teamColors[i-1]}40`,
|
|
transition: { duration: 0.15 }
|
|
}}
|
|
>
|
|
<div
|
|
className="absolute left-0 top-0 bottom-0 w-0.5"
|
|
style={{ backgroundColor: teamColors[i-1] }}
|
|
/>
|
|
<div
|
|
className="h-5 w-5 rounded-full flex items-center justify-center font-semibold text-[10px] border-2"
|
|
style={{
|
|
borderColor: teamColors[i-1],
|
|
backgroundColor: `${teamColors[i-1]}20`
|
|
}}
|
|
>
|
|
<span className="text-white">{i}</span>
|
|
</div>
|
|
<div className="flex-1 min-w-0">
|
|
<div className="h-2.5 w-full bg-white/10 rounded"></div>
|
|
</div>
|
|
<div className="h-3 w-12 bg-charcoal-outline rounded font-mono text-[10px] flex items-center justify-center text-white/70"></div>
|
|
{hoveredDriver === i && (
|
|
<motion.div
|
|
className="absolute inset-0 pointer-events-none"
|
|
initial={{ opacity: 0 }}
|
|
animate={{ opacity: 1 }}
|
|
style={{
|
|
background: `linear-gradient(90deg, ${teamColors[i-1]}10 0%, transparent 100%)`
|
|
}}
|
|
/>
|
|
)}
|
|
</motion.div>
|
|
))}
|
|
</div>
|
|
</motion.div>
|
|
|
|
<div className="absolute left-1/2 top-8 bottom-8 w-px bg-gradient-to-b from-transparent via-charcoal-outline to-transparent backdrop-blur-sm" />
|
|
|
|
<motion.div
|
|
variants={rightColumnVariants}
|
|
initial="hidden"
|
|
animate="visible"
|
|
className="relative"
|
|
>
|
|
<div className="h-5 w-32 bg-white/10 rounded mb-4 text-xs flex items-center justify-center text-white font-semibold">
|
|
Constructors
|
|
</div>
|
|
<div className="space-y-2">
|
|
{[1, 2, 3, 4, 5].map((i) => (
|
|
<motion.div
|
|
key={i}
|
|
custom={i}
|
|
variants={rowVariants}
|
|
initial="hidden"
|
|
animate="visible"
|
|
className="relative flex items-center gap-3 bg-iron-gray rounded-lg p-2.5 border border-charcoal-outline overflow-hidden"
|
|
onHoverStart={() => !shouldReduceMotion && setHoveredTeam(i)}
|
|
onHoverEnd={() => setHoveredTeam(null)}
|
|
whileHover={shouldReduceMotion ? {} : {
|
|
scale: 1.02,
|
|
boxShadow: `0 0 20px ${teamColors[i-1]}40`,
|
|
transition: { duration: 0.15 }
|
|
}}
|
|
>
|
|
<div
|
|
className="absolute left-0 top-0 bottom-0 w-0.5"
|
|
style={{ backgroundColor: teamColors[i-1] }}
|
|
/>
|
|
<div
|
|
className="h-5 w-5 rounded flex items-center justify-center font-semibold text-[10px] border-2"
|
|
style={{
|
|
borderColor: teamColors[i-1],
|
|
backgroundColor: `${teamColors[i-1]}20`
|
|
}}
|
|
>
|
|
<span className="text-white">{i}</span>
|
|
</div>
|
|
<div className="flex-1 min-w-0">
|
|
<div className="h-2.5 w-full bg-white/10 rounded mb-1.5"></div>
|
|
<div className="relative h-1.5 bg-charcoal-outline rounded-full overflow-hidden">
|
|
<motion.div
|
|
className="absolute inset-y-0 left-0 rounded-full"
|
|
style={{ backgroundColor: teamColors[i-1] }}
|
|
initial={{ width: '0%' }}
|
|
animate={{ width: `${100 - (i-1) * 15}%` }}
|
|
transition={{ duration: shouldReduceMotion ? 0 : 0.8, delay: 0.4 + i * 0.05 }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
{i === 3 && (
|
|
<div className="h-4 px-1.5 bg-warning-amber/20 rounded text-[9px] flex items-center justify-center text-warning-amber font-semibold border border-warning-amber/30">
|
|
=
|
|
</div>
|
|
)}
|
|
{hoveredTeam === i && (
|
|
<motion.div
|
|
className="absolute inset-0 pointer-events-none"
|
|
initial={{ opacity: 0 }}
|
|
animate={{ opacity: 1 }}
|
|
style={{
|
|
background: `linear-gradient(90deg, ${teamColors[i-1]}10 0%, transparent 100%)`
|
|
}}
|
|
/>
|
|
)}
|
|
</motion.div>
|
|
))}
|
|
</div>
|
|
</motion.div>
|
|
</div>
|
|
</div>
|
|
);
|
|
} |