import React, { useState, useEffect } from 'react'; import { motion, useAnimation } from 'framer-motion'; const Step = ({ step, index, isActive }) => { const controls = useAnimation(); useEffect(() => { if (isActive) { controls.start({ opacity: 1, x: 0 }); } else { controls.start({ opacity: 0.5, x: -20 }); } }, [isActive, controls]); return (
{index + 1}

{step.title}

{step.description}

{/* Optional Call-to-action or additional details */} {/* */}
); }; const HowItWorks = ({ steps }) => { const [activeStep, setActiveStep] = useState(0); const containerRef = React.createRef(); // Optional Progress Bar for Steps // You can implement this as a separate component or inline here. return (
{/* Title Section */}

How It Works

{/* Steps Container */}
{steps.map((step, index) => ( setActiveStep(index)} // Change active step on hover onMouseLeave={() => setActiveStep(0)} // Reset to first step when not hovering > {/* Render the Step Component here */} ))}
); }; export default HowItWorks;