website refactor
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
import { motion, useReducedMotion } from 'framer-motion';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Box } from '@/ui/Box';
|
||||
import { Text } from '@/ui/Text';
|
||||
import { Stack } from '@/ui/Stack';
|
||||
|
||||
export default function TeamCompetitionMockup() {
|
||||
export function TeamCompetitionMockup() {
|
||||
const shouldReduceMotion = useReducedMotion();
|
||||
const [hoveredDriver, setHoveredDriver] = useState<number | null>(null);
|
||||
const [hoveredTeam, setHoveredTeam] = useState<number | null>(null);
|
||||
@@ -17,79 +20,138 @@ export default function TeamCompetitionMockup() {
|
||||
|
||||
if (isMobile) {
|
||||
return (
|
||||
<div className="relative w-full h-full bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite rounded-lg p-3 overflow-hidden">
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<div className="text-sm font-semibold text-white mb-3">Drivers</div>
|
||||
<div className="space-y-2">
|
||||
<Box position="relative" fullWidth fullHeight bg="bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite" rounded="lg" p={3} overflow="hidden">
|
||||
<Stack gap={4}>
|
||||
<Box>
|
||||
<Text size="sm" weight="semibold" color="text-white" mb={3} block>Drivers</Text>
|
||||
<Stack gap={2}>
|
||||
{[1, 2, 3].map((i) => (
|
||||
<div
|
||||
<Box
|
||||
key={i}
|
||||
className="relative flex items-center gap-2 bg-iron-gray rounded-lg p-2 border border-charcoal-outline overflow-hidden"
|
||||
position="relative"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
gap={2}
|
||||
bg="bg-iron-gray"
|
||||
rounded="lg"
|
||||
p={2}
|
||||
border
|
||||
borderColor="border-charcoal-outline"
|
||||
overflow="hidden"
|
||||
>
|
||||
<div
|
||||
className="absolute left-0 top-0 bottom-0 w-1"
|
||||
<Box
|
||||
position="absolute"
|
||||
left="0"
|
||||
top="0"
|
||||
bottom="0"
|
||||
w="1"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ backgroundColor: teamColors[i-1] }}
|
||||
/>
|
||||
<div
|
||||
className="h-5 w-5 rounded-full flex items-center justify-center font-semibold text-xs border-2"
|
||||
<Box
|
||||
h="5"
|
||||
w="5"
|
||||
rounded="full"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
weight="semibold"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
borderColor: teamColors[i-1],
|
||||
backgroundColor: `${teamColors[i-1]}20`
|
||||
backgroundColor: `${teamColors[i-1]}20`,
|
||||
borderWidth: '2px'
|
||||
}}
|
||||
>
|
||||
<span className="text-white">{i}</span>
|
||||
</div>
|
||||
<div className="h-6 w-6 rounded-full flex items-center justify-center text-sm" style={{ backgroundColor: `${teamColors[i-1]}20`, borderWidth: '1px', borderColor: teamColors[i-1] }}>
|
||||
🏎️
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="h-2.5 w-full bg-white/10 rounded"></div>
|
||||
</div>
|
||||
<div className="h-3 w-10 bg-charcoal-outline rounded text-xs flex items-center justify-center text-white/70"></div>
|
||||
</div>
|
||||
<Text color="text-white">{i}</Text>
|
||||
</Box>
|
||||
<Box h="6" w="6" rounded="full" display="flex" alignItems="center" justifyContent="center"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ backgroundColor: `${teamColors[i-1]}20`, borderWidth: '1px', borderColor: teamColors[i-1], fontSize: '14px' }}
|
||||
>
|
||||
<Text>🏎️</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1}>
|
||||
<Box h="2.5" w="full" bg="bg-white/10" rounded="sm" />
|
||||
</Box>
|
||||
<Box h="3" w="10" bg="bg-charcoal-outline" rounded="sm" display="flex" alignItems="center" justifyContent="center" color="text-white" opacity={0.7}
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ fontSize: '10px' }}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
<div className="h-px bg-gradient-to-r from-transparent via-charcoal-outline to-transparent" />
|
||||
<Box h="px"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
className="bg-gradient-to-r from-transparent via-charcoal-outline to-transparent"
|
||||
/>
|
||||
|
||||
<div>
|
||||
<div className="text-sm font-semibold text-white mb-3">Constructors</div>
|
||||
<div className="space-y-2">
|
||||
<Box>
|
||||
<Text size="sm" weight="semibold" color="text-white" mb={3} block>Constructors</Text>
|
||||
<Stack gap={2}>
|
||||
{[1, 2, 3].map((i) => (
|
||||
<div
|
||||
<Box
|
||||
key={i}
|
||||
className="relative flex items-center gap-2 bg-iron-gray rounded-lg p-2 border border-charcoal-outline overflow-hidden"
|
||||
position="relative"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
gap={2}
|
||||
bg="bg-iron-gray"
|
||||
rounded="lg"
|
||||
p={2}
|
||||
border
|
||||
borderColor="border-charcoal-outline"
|
||||
overflow="hidden"
|
||||
>
|
||||
<div
|
||||
className="absolute left-0 top-0 bottom-0 w-1"
|
||||
<Box
|
||||
position="absolute"
|
||||
left="0"
|
||||
top="0"
|
||||
bottom="0"
|
||||
w="1"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ backgroundColor: teamColors[i-1] }}
|
||||
/>
|
||||
<div
|
||||
className="h-6 w-6 rounded flex items-center justify-center text-sm border-2"
|
||||
<Box
|
||||
h="6"
|
||||
w="6"
|
||||
rounded="sm"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
border
|
||||
borderWidth="2px"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{
|
||||
borderColor: teamColors[i-1],
|
||||
backgroundColor: `${teamColors[i-1]}20`
|
||||
backgroundColor: `${teamColors[i-1]}20`,
|
||||
fontSize: '14px'
|
||||
}}
|
||||
>
|
||||
🏁
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="h-2.5 w-full bg-white/10 rounded mb-1"></div>
|
||||
<div className="relative h-1.5 bg-charcoal-outline rounded-full overflow-hidden">
|
||||
<div
|
||||
className="absolute inset-y-0 left-0 rounded-full"
|
||||
<Text>🏁</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1}>
|
||||
<Box h="2.5" w="full" bg="bg-white/10" rounded="sm" mb={1} />
|
||||
<Box position="relative" h="1.5" bg="bg-charcoal-outline" rounded="full" overflow="hidden">
|
||||
<Box
|
||||
position="absolute"
|
||||
insetY="0"
|
||||
left="0"
|
||||
rounded="full"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ backgroundColor: teamColors[i-1], width: `${100 - (i-1) * 15}%` }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -134,26 +196,44 @@ export default function TeamCompetitionMockup() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="relative w-full h-full bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite rounded-lg p-1.5 sm:p-3 md:p-4 lg:p-6 overflow-hidden">
|
||||
<div className="grid grid-cols-2 gap-2 sm:gap-3 md:gap-4 lg:gap-6 h-full">
|
||||
<motion.div
|
||||
<Box position="relative" fullWidth fullHeight bg="bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite" rounded="lg" p={{ base: 1.5, sm: 3, md: 4, lg: 6 }} overflow="hidden">
|
||||
<Box display="grid" gridCols={2} gap={{ base: 2, sm: 3, md: 4, lg: 6 }} fullHeight>
|
||||
<Box
|
||||
as={motion.div}
|
||||
variants={leftColumnVariants}
|
||||
initial="hidden"
|
||||
animate="visible"
|
||||
className="relative"
|
||||
position="relative"
|
||||
>
|
||||
<div className="h-3 sm:h-4 md:h-5 w-16 sm:w-20 md:w-24 bg-white/10 rounded mb-1.5 sm:mb-2 md:mb-3 lg:mb-4 text-[8px] sm:text-[10px] md:text-xs flex items-center justify-center text-white font-semibold">
|
||||
Drivers
|
||||
</div>
|
||||
<div className="space-y-1 sm:space-y-1.5 md:space-y-2">
|
||||
<Box h={{ base: 3, sm: 4, md: 5 }} w={{ base: 16, sm: 20, md: 24 }} bg="bg-white/10" rounded="sm" mb={{ base: 1.5, sm: 2, md: 3, lg: 4 }} display="flex" alignItems="center" justifyContent="center">
|
||||
<Text
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ fontSize: '10px' }}
|
||||
color="text-white"
|
||||
weight="semibold"
|
||||
>
|
||||
Drivers
|
||||
</Text>
|
||||
</Box>
|
||||
<Stack gap={{ base: 1, sm: 1.5, md: 2 }}>
|
||||
{[1, 2, 3, 4, 5].map((i) => (
|
||||
<motion.div
|
||||
<Box
|
||||
key={i}
|
||||
as={motion.div}
|
||||
custom={i}
|
||||
variants={rowVariants}
|
||||
initial="hidden"
|
||||
animate="visible"
|
||||
className="relative flex items-center gap-1.5 sm:gap-2 md:gap-2.5 lg:gap-3 bg-iron-gray rounded-lg p-1 sm:p-1.5 md:p-2 lg:p-2.5 border border-charcoal-outline overflow-hidden"
|
||||
position="relative"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
gap={{ base: 1.5, sm: 2, md: 2.5, lg: 3 }}
|
||||
bg="bg-iron-gray"
|
||||
rounded="lg"
|
||||
p={{ base: 1, sm: 1.5, md: 2, lg: 2.5 }}
|
||||
border
|
||||
borderColor="border-charcoal-outline"
|
||||
overflow="hidden"
|
||||
onHoverStart={() => !shouldReduceMotion && setHoveredDriver(i)}
|
||||
onHoverEnd={() => setHoveredDriver(null)}
|
||||
whileHover={shouldReduceMotion ? {} : {
|
||||
@@ -162,61 +242,107 @@ export default function TeamCompetitionMockup() {
|
||||
transition: { duration: 0.15 }
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="absolute left-0 top-0 bottom-0 w-0.5"
|
||||
<Box
|
||||
position="absolute"
|
||||
left="0"
|
||||
top="0"
|
||||
bottom="0"
|
||||
w="0.5"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ backgroundColor: teamColors[i-1] }}
|
||||
/>
|
||||
<div
|
||||
className="h-3.5 w-3.5 sm:h-4 sm:w-4 md:h-5 md:w-5 rounded-full flex items-center justify-center font-semibold text-[8px] sm:text-[9px] md:text-[10px] border-2"
|
||||
<Box
|
||||
h={{ base: 3.5, sm: 4, md: 5 }}
|
||||
w={{ base: 3.5, sm: 4, md: 5 }}
|
||||
rounded="full"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
weight="semibold"
|
||||
border
|
||||
borderWidth="2px"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
borderColor: teamColors[i-1],
|
||||
backgroundColor: `${teamColors[i-1]}20`
|
||||
}}
|
||||
>
|
||||
<span className="text-white">{i}</span>
|
||||
</div>
|
||||
<div className="h-5 w-5 sm:h-6 sm:w-6 md:h-7 md:w-7 rounded-full flex items-center justify-center text-[10px] sm:text-xs" style={{ backgroundColor: `${teamColors[i-1]}20`, borderWidth: '1px', borderColor: teamColors[i-1] }}>
|
||||
🏎️
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="h-1.5 sm:h-2 md:h-2.5 w-full bg-white/10 rounded"></div>
|
||||
</div>
|
||||
<div className="h-2 sm:h-2.5 md:h-3 w-8 sm:w-10 md:w-12 bg-charcoal-outline rounded font-mono text-[8px] sm:text-[9px] md:text-[10px] flex items-center justify-center text-white/70"></div>
|
||||
<Text color="text-white">{i}</Text>
|
||||
</Box>
|
||||
<Box h={{ base: 5, sm: 6, md: 7 }} w={{ base: 5, sm: 6, md: 7 }} rounded="full" display="flex" alignItems="center" justifyContent="center"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ backgroundColor: `${teamColors[i-1]}20`, borderWidth: '1px', borderColor: teamColors[i-1], fontSize: '12px' }}
|
||||
>
|
||||
<Text>🏎️</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1} minWidth="0">
|
||||
<Box h={{ base: 1.5, sm: 2, md: 2.5 }} w="full" bg="bg-white/10" rounded="sm" />
|
||||
</Box>
|
||||
<Box h={{ base: 2, sm: 2.5, md: 3 }} w={{ base: 8, sm: 10, md: 12 }} bg="bg-charcoal-outline" rounded="sm" font="mono" display="flex" alignItems="center" justifyContent="center" color="text-white" opacity={0.7}
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ fontSize: '10px' }}
|
||||
/>
|
||||
{hoveredDriver === i && (
|
||||
<motion.div
|
||||
className="absolute inset-0 pointer-events-none"
|
||||
<Box
|
||||
as={motion.div}
|
||||
position="absolute"
|
||||
inset="0"
|
||||
pointerEvents="none"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{
|
||||
background: `linear-gradient(90deg, ${teamColors[i-1]}10 0%, transparent 100%)`
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</motion.div>
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</motion.div>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
<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" />
|
||||
<Box position="absolute" left="1/2" top="8" bottom="8" w="px"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
className="bg-gradient-to-b from-transparent via-charcoal-outline to-transparent backdrop-blur-sm"
|
||||
/>
|
||||
|
||||
<motion.div
|
||||
<Box
|
||||
as={motion.div}
|
||||
variants={rightColumnVariants}
|
||||
initial="hidden"
|
||||
animate="visible"
|
||||
className="relative"
|
||||
position="relative"
|
||||
>
|
||||
<div className="h-3 sm:h-4 md:h-5 w-20 sm:w-24 md:w-32 bg-white/10 rounded mb-1.5 sm:mb-2 md:mb-3 lg:mb-4 text-[8px] sm:text-[10px] md:text-xs flex items-center justify-center text-white font-semibold">
|
||||
Constructors
|
||||
</div>
|
||||
<div className="space-y-1 sm:space-y-1.5 md:space-y-2">
|
||||
<Box h={{ base: 3, sm: 4, md: 5 }} w={{ base: 20, sm: 24, md: 32 }} bg="bg-white/10" rounded="sm" mb={{ base: 1.5, sm: 2, md: 3, lg: 4 }} display="flex" alignItems="center" justifyContent="center">
|
||||
<Text
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ fontSize: '10px' }}
|
||||
color="text-white"
|
||||
weight="semibold"
|
||||
>
|
||||
Constructors
|
||||
</Text>
|
||||
</Box>
|
||||
<Stack gap={{ base: 1, sm: 1.5, md: 2 }}>
|
||||
{[1, 2, 3, 4, 5].map((i) => (
|
||||
<motion.div
|
||||
<Box
|
||||
key={i}
|
||||
as={motion.div}
|
||||
custom={i}
|
||||
variants={rowVariants}
|
||||
initial="hidden"
|
||||
animate="visible"
|
||||
className="relative flex items-center gap-1.5 sm:gap-2 md:gap-2.5 lg:gap-3 bg-iron-gray rounded-lg p-1 sm:p-1.5 md:p-2 lg:p-2.5 border border-charcoal-outline overflow-hidden"
|
||||
position="relative"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
gap={{ base: 1.5, sm: 2, md: 2.5, lg: 3 }}
|
||||
bg="bg-iron-gray"
|
||||
rounded="lg"
|
||||
p={{ base: 1, sm: 1.5, md: 2, lg: 2.5 }}
|
||||
border
|
||||
borderColor="border-charcoal-outline"
|
||||
overflow="hidden"
|
||||
onHoverStart={() => !shouldReduceMotion && setHoveredTeam(i)}
|
||||
onHoverEnd={() => setHoveredTeam(null)}
|
||||
whileHover={shouldReduceMotion ? {} : {
|
||||
@@ -225,51 +351,79 @@ export default function TeamCompetitionMockup() {
|
||||
transition: { duration: 0.15 }
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="absolute left-0 top-0 bottom-0 w-0.5"
|
||||
<Box
|
||||
position="absolute"
|
||||
left="0"
|
||||
top="0"
|
||||
bottom="0"
|
||||
w="0.5"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ backgroundColor: teamColors[i-1] }}
|
||||
/>
|
||||
<div
|
||||
className="h-5 w-5 sm:h-6 sm:w-6 md:h-7 md:w-7 rounded flex items-center justify-center text-[10px] sm:text-xs md:text-sm border-2"
|
||||
<Box
|
||||
h={{ base: 5, sm: 6, md: 7 }}
|
||||
w={{ base: 5, sm: 6, md: 7 }}
|
||||
rounded="sm"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
border
|
||||
borderWidth="2px"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
borderColor: teamColors[i-1],
|
||||
backgroundColor: `${teamColors[i-1]}20`
|
||||
}}
|
||||
>
|
||||
🏁
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="h-1.5 sm:h-2 md:h-2.5 w-full bg-white/10 rounded mb-0.5 sm:mb-1 md:mb-1.5"></div>
|
||||
<div className="relative h-0.5 sm:h-1 md:h-1.5 bg-charcoal-outline rounded-full overflow-hidden">
|
||||
<motion.div
|
||||
className="absolute inset-y-0 left-0 rounded-full"
|
||||
<Text>🏁</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1} minWidth="0">
|
||||
<Box h={{ base: 1.5, sm: 2, md: 2.5 }} w="full" bg="bg-white/10" rounded="sm" mb={{ base: 0.5, sm: 1, md: 1.5 }} />
|
||||
<Box position="relative" h={{ base: 0.5, sm: 1, md: 1.5 }} bg="bg-charcoal-outline" rounded="full" overflow="hidden">
|
||||
<Box
|
||||
as={motion.div}
|
||||
position="absolute"
|
||||
insetY="0"
|
||||
left="0"
|
||||
rounded="full"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
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>
|
||||
</Box>
|
||||
</Box>
|
||||
{i === 3 && (
|
||||
<div className="h-3 sm:h-3.5 md:h-4 px-0.5 sm:px-1 md:px-1.5 bg-warning-amber/20 rounded text-[7px] sm:text-[8px] md:text-[9px] flex items-center justify-center text-warning-amber font-semibold border border-warning-amber/30">
|
||||
=
|
||||
</div>
|
||||
<Box h={{ base: 3, sm: 3.5, md: 4 }} px={{ base: 0.5, sm: 1, md: 1.5 }} bg="bg-warning-amber/20" rounded="sm" display="flex" alignItems="center" justifyContent="center" color="text-warning-amber" weight="semibold" border borderColor="border-warning-amber/30">
|
||||
<Text
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ fontSize: '10px' }}
|
||||
>
|
||||
=
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
{hoveredTeam === i && (
|
||||
<motion.div
|
||||
className="absolute inset-0 pointer-events-none"
|
||||
<Box
|
||||
as={motion.div}
|
||||
position="absolute"
|
||||
inset="0"
|
||||
pointerEvents="none"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{
|
||||
background: `linear-gradient(90deg, ${teamColors[i-1]}10 0%, transparent 100%)`
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</motion.div>
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
</div>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user