website refactor
This commit is contained in:
@@ -2,14 +2,19 @@
|
||||
|
||||
import { motion, useReducedMotion } from 'framer-motion';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Box } from '@/ui/Box';
|
||||
import { Text } from '@/ui/Text';
|
||||
|
||||
export default function ProtestWorkflowMockup() {
|
||||
export function ProtestWorkflowMockup() {
|
||||
const shouldReduceMotion = useReducedMotion();
|
||||
const [activeStep, setActiveStep] = useState<number>(1);
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setIsMobile(window.innerWidth < 768);
|
||||
const checkMobile = () => setIsMobile(window.innerWidth < 768);
|
||||
checkMobile();
|
||||
window.addEventListener('resize', checkMobile);
|
||||
return () => window.removeEventListener('resize', checkMobile);
|
||||
}, []);
|
||||
|
||||
const steps = [
|
||||
@@ -44,36 +49,53 @@ export default function ProtestWorkflowMockup() {
|
||||
|
||||
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 overflow-hidden p-3 flex flex-col justify-center gap-4">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<Box position="relative" fullWidth fullHeight bg="bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite" rounded="lg" overflow="hidden" p={3} display="flex" flexDirection="col" justifyContent="center" gap={4}>
|
||||
<Box display="flex" alignItems="center" justifyContent="center" gap={3}>
|
||||
{steps.map((step, i) => (
|
||||
<div key={step.name} className="flex items-center">
|
||||
<div className="flex flex-col items-center">
|
||||
<div
|
||||
className={`w-10 h-10 rounded-lg flex items-center justify-center mb-1 border-2 ${getStatusColor(step.status)}`}
|
||||
<Box key={step.name} display="flex" alignItems="center">
|
||||
<Box display="flex" flexDirection="col" alignItems="center">
|
||||
<Box
|
||||
w="10"
|
||||
h="10"
|
||||
rounded="lg"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
mb={1}
|
||||
border
|
||||
borderWidth="2px"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
className={getStatusColor(step.status)}
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<Box as="svg" w="5" h="5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
{/* eslint-disable-next-line gridpilot-rules/component-classification */}
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d={step.icon} />
|
||||
</svg>
|
||||
</div>
|
||||
<div className="text-xs text-white/70 text-center">{step.name}</div>
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
<Text size="xs" color="text-white" opacity={0.7} textAlign="center">{step.name}</Text>
|
||||
</Box>
|
||||
{i < steps.length - 1 && (
|
||||
<svg className="w-4 h-4 mx-1" viewBox="0 0 24 24" fill="none">
|
||||
<Box as="svg" w="4" h="4" mx={1} viewBox="0 0 24 24" fill="none">
|
||||
{/* eslint-disable-next-line gridpilot-rules/component-classification */}
|
||||
<path d="M5 12h14m-7-7l7 7-7 7" stroke="#43C9E6" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
</svg>
|
||||
</Box>
|
||||
)}
|
||||
</div>
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
<div className="relative h-1 bg-charcoal-outline rounded-full overflow-hidden">
|
||||
<div
|
||||
className="absolute inset-y-0 left-0 bg-gradient-to-r from-neon-aqua to-primary-blue rounded-full"
|
||||
<Box position="relative" h="1" bg="bg-charcoal-outline" rounded="full" overflow="hidden">
|
||||
<Box
|
||||
position="absolute"
|
||||
insetY="0"
|
||||
left="0"
|
||||
bg="bg-gradient-to-r from-neon-aqua to-primary-blue"
|
||||
rounded="full"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ width: `${((activeStep + 1) / steps.length) * 100}%` }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,100 +113,135 @@ export default function ProtestWorkflowMockup() {
|
||||
})
|
||||
};
|
||||
|
||||
const arrowVariants = {
|
||||
hidden: { opacity: 0, pathLength: 0 },
|
||||
visible: (i: number) => ({
|
||||
opacity: 1,
|
||||
pathLength: 1,
|
||||
transition: {
|
||||
delay: shouldReduceMotion ? 0 : i * 0.2 + 0.1,
|
||||
duration: 0.5,
|
||||
ease: 'easeOut' as const
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="relative w-full h-full bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite rounded-lg overflow-hidden p-1.5 sm:p-3 md:p-5 lg:p-8 flex flex-col justify-center gap-2 sm:gap-4 md:gap-6 lg:gap-8">
|
||||
<div className="flex flex-col md:flex-row items-center justify-center gap-2 sm:gap-3 md:gap-4">
|
||||
<Box position="relative" fullWidth fullHeight bg="bg-gradient-to-br from-deep-graphite via-iron-gray to-deep-graphite" rounded="lg" overflow="hidden" p={{ base: 1.5, sm: 3, md: 5, lg: 8 }} display="flex" flexDirection="col" justifyContent="center" gap={{ base: 2, sm: 4, md: 6, lg: 8 }}>
|
||||
<Box display="flex" flexDirection={{ base: 'col', md: 'row' }} alignItems="center" justifyContent="center" gap={{ base: 2, sm: 3, md: 4 }}>
|
||||
{steps.map((step, i) => (
|
||||
<div key={step.name} className="flex items-center flex-shrink-0">
|
||||
<motion.div
|
||||
<Box key={step.name} display="flex" alignItems="center" flexShrink={0}>
|
||||
<Box
|
||||
as={motion.div}
|
||||
custom={i}
|
||||
variants={stepVariants}
|
||||
initial="hidden"
|
||||
animate="visible"
|
||||
className="flex flex-col items-center"
|
||||
display="flex"
|
||||
flexDirection="col"
|
||||
alignItems="center"
|
||||
onHoverStart={() => !shouldReduceMotion && setActiveStep(i)}
|
||||
>
|
||||
<motion.div
|
||||
className={`relative w-8 h-8 sm:w-10 sm:h-10 md:w-12 md:h-12 lg:w-14 lg:h-14 rounded-lg flex items-center justify-center mb-1 sm:mb-1.5 md:mb-2 border-2 ${getStatusColor(step.status)}`}
|
||||
whileHover={shouldReduceMotion ? {} : {
|
||||
scale: 1.1,
|
||||
boxShadow: step.status === 'active'
|
||||
? '0 0 32px rgba(255,197,86,0.4)'
|
||||
: step.status === 'resolved'
|
||||
? '0 0 32px rgba(111,227,122,0.4)'
|
||||
: '0 0 20px rgba(34,38,42,0.4)',
|
||||
transition: { duration: 0.2 }
|
||||
}}
|
||||
<Box
|
||||
as={motion.div}
|
||||
position="relative"
|
||||
w={{ base: 8, sm: 10, md: 12, lg: 14 }}
|
||||
h={{ base: 8, sm: 10, md: 12, lg: 14 }}
|
||||
rounded="lg"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
mb={{ base: 1, sm: 1.5, md: 2 }}
|
||||
border
|
||||
borderWidth="2px"
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
className={getStatusColor(step.status)}
|
||||
whileHover={shouldReduceMotion ? {} : {
|
||||
scale: 1.1,
|
||||
boxShadow: step.status === 'active'
|
||||
? '0 0 32px rgba(255,197,86,0.4)'
|
||||
: step.status === 'resolved'
|
||||
? '0 0 32px rgba(111,227,122,0.4)'
|
||||
: '0 0 20px rgba(34,38,42,0.4)',
|
||||
transition: { duration: 0.2 }
|
||||
}}
|
||||
transition={{ type: 'spring', stiffness: 300, damping: 15 }}
|
||||
>
|
||||
<svg className="w-4 h-4 sm:w-5 sm:h-5 md:w-6 md:h-6 lg:w-7 lg:h-7" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<Box as="svg" w={{ base: 4, sm: 5, md: 6, lg: 7 }} h={{ base: 4, sm: 5, md: 6, lg: 7 }} fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
{/* eslint-disable-next-line gridpilot-rules/component-classification */}
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d={step.icon} />
|
||||
</svg>
|
||||
</Box>
|
||||
{step.status === 'active' && (
|
||||
<motion.div
|
||||
className="absolute inset-0 rounded-lg"
|
||||
<Box
|
||||
as={motion.div}
|
||||
position="absolute"
|
||||
inset="0"
|
||||
rounded="lg"
|
||||
animate={shouldReduceMotion ? {} : {
|
||||
boxShadow: [
|
||||
'0 0 20px rgba(255,197,86,0.3)',
|
||||
'0 0 20px rgba(25,140,255,0.3)',
|
||||
'0 0 32px rgba(255,197,86,0.5)',
|
||||
'0 0 20px rgba(255,197,86,0.3)'
|
||||
'0 0 20px rgba(25,140,255,0.3)'
|
||||
]
|
||||
}}
|
||||
transition={{ duration: 2, repeat: Infinity }}
|
||||
/>
|
||||
)}
|
||||
</motion.div>
|
||||
<div className="text-[8px] sm:text-[10px] md:text-xs text-white/70 text-center mb-0.5">{step.name}</div>
|
||||
<motion.div
|
||||
className={`h-0.5 sm:h-1 md:h-1.5 w-6 sm:w-8 md:w-10 lg:w-12 rounded ${
|
||||
</Box>
|
||||
<Text
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
style={{ fontSize: '8px' }}
|
||||
color="text-white"
|
||||
opacity={0.7}
|
||||
textAlign="center"
|
||||
mb={0.5}
|
||||
>
|
||||
{step.name}
|
||||
</Text>
|
||||
<Box
|
||||
as={motion.div}
|
||||
h={{ base: 0.5, sm: 1, md: 1.5 }}
|
||||
w={{ base: 6, sm: 8, md: 10, lg: 12 }}
|
||||
rounded="sm"
|
||||
bg={
|
||||
step.status === 'pending' ? 'bg-charcoal-outline' :
|
||||
step.status === 'active' ? 'bg-warning-amber/30' :
|
||||
'bg-performance-green/30'
|
||||
}`}
|
||||
}
|
||||
animate={shouldReduceMotion ? {} : step.status === 'active' ? {
|
||||
opacity: [0.5, 1, 0.5]
|
||||
} : {}}
|
||||
transition={{ duration: 2, repeat: Infinity }}
|
||||
/>
|
||||
</motion.div>
|
||||
</Box>
|
||||
|
||||
{i < steps.length - 1 && (
|
||||
<div className="hidden md:block relative ml-1">
|
||||
<svg className="w-3 h-3 sm:w-4 sm:h-4 md:w-5 md:h-5" viewBox="0 0 24 24" fill="none">
|
||||
<Box
|
||||
// eslint-disable-next-line gridpilot-rules/component-classification
|
||||
className="hidden md:block"
|
||||
position="relative"
|
||||
ml={1}
|
||||
>
|
||||
<Box as="svg" w={{ base: 3, sm: 4, md: 5 }} h={{ base: 3, sm: 4, md: 5 }} viewBox="0 0 24 24" fill="none">
|
||||
{/* eslint-disable-next-line gridpilot-rules/component-classification */}
|
||||
<path d="M5 12h14m-7-7l7 7-7 7" stroke="#43C9E6" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
</div>
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
<motion.div
|
||||
<Box
|
||||
as={motion.div}
|
||||
initial={{ opacity: 0, scaleX: 0 }}
|
||||
animate={{ opacity: 1, scaleX: 1 }}
|
||||
transition={{ delay: shouldReduceMotion ? 0 : 0.8, duration: 0.6 }}
|
||||
className="relative h-0.5 sm:h-0.5 md:h-1 bg-charcoal-outline rounded-full overflow-hidden"
|
||||
position="relative"
|
||||
h={{ base: 0.5, md: 1 }}
|
||||
bg="bg-charcoal-outline"
|
||||
rounded="full"
|
||||
overflow="hidden"
|
||||
>
|
||||
<motion.div
|
||||
className="absolute inset-y-0 left-0 bg-gradient-to-r from-neon-aqua to-primary-blue rounded-full"
|
||||
<Box
|
||||
as={motion.div}
|
||||
position="absolute"
|
||||
insetY="0"
|
||||
left="0"
|
||||
bg="bg-gradient-to-r from-neon-aqua to-primary-blue"
|
||||
rounded="full"
|
||||
initial={{ width: '0%' }}
|
||||
animate={{ width: `${((activeStep + 1) / steps.length) * 100}%` }}
|
||||
transition={{ duration: 0.5, ease: 'easeOut' }}
|
||||
/>
|
||||
</motion.div>
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user