'use client'; import { motion, useReducedMotion, useMotionValue, useSpring, useTransform } from 'framer-motion'; import { useEffect, useState } from 'react'; export default function DriverProfileMockup() { const shouldReduceMotion = useReducedMotion(); const [isMobile, setIsMobile] = useState(false); useEffect(() => { setIsMobile(window.innerWidth < 768); }, []); const stats = [ { label: 'Wins', value: 24 }, { label: 'Podiums', value: 48 }, { label: 'Championships', value: 3 }, { label: 'Races', value: 156 }, { label: 'Finish Rate', value: 94, suffix: '%' } ]; const formData = [85, 72, 68, 91, 88, 95, 88, 79, 82, 91]; if (isMobile) { return (
🏎️
Driver Profile
Cross-league
#33
2150 GP Rating
Career Stats
{stats.slice(0, 3).map((stat) => (
{stat.value}{stat.suffix}
{stat.label}
))}
Recent Form
{formData.slice(-6).map((value, i) => (
))}
); } const containerVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { staggerChildren: shouldReduceMotion ? 0 : 0.1 } } }; const itemVariants = { hidden: { opacity: 0, y: shouldReduceMotion ? 0 : 10 }, visible: { opacity: 1, y: 0, transition: { type: 'spring' as const, stiffness: 200, damping: 20 } } }; return (
🏎️
Driver Profile
Cross-league racing identity
#33
GridPilot Rating:
iRating:
86%
Career Statistics
Aggregated across all leagues
{stats.map((stat, index) => (
{stat.label}
))}
Recent Form
Performance trend over last 10 races
{formData.map((value, i) => ( ))}
Last 10 races Recent
Teams
Current and past team memberships
{[ { team: 'Red Bull Racing', status: 'Current', color: 'primary-blue' }, { team: 'Mercedes AMG', status: '2023', color: 'charcoal-outline' } ].map((team, i) => (
🏁
{team.status}
))}
Active in 3 leagues
); } function AnimatedRating({ shouldReduceMotion, value }: { shouldReduceMotion: boolean; value: number }) { const count = useMotionValue(0); const rounded = useTransform(count, (v: number) => Math.round(v)); const spring = useSpring(count, { stiffness: 50, damping: 25 }); useEffect(() => { if (shouldReduceMotion) { count.set(value); } else { const timeout = setTimeout(() => count.set(value), 200); return () => clearTimeout(timeout); } }, [shouldReduceMotion, count, value]); return ( {shouldReduceMotion ? value : {rounded}} ); } function AnimatedCounter({ value, shouldReduceMotion, delay, suffix = '' }: { value: number; shouldReduceMotion: boolean; delay: number; suffix?: string; }) { const count = useMotionValue(0); const rounded = useTransform(count, (v: number) => Math.round(v)); useEffect(() => { if (shouldReduceMotion) { count.set(value); } else { const timeout = setTimeout(() => count.set(value), delay * 1000 + 400); return () => clearTimeout(timeout); } }, [shouldReduceMotion, count, value, delay]); return (
{shouldReduceMotion ? value : {rounded}}{suffix}
); }