ExamCraftAI / Frontend /src /pages /Generate /components /StepIndicator.jsx
Hkoradiya123
Initial commit
5463318
Raw History Blame Contribute Delete
2.85 kB
import React from 'react';
import { motion } from 'framer-motion';
import { useGenerate } from '../GenerateContext';
import { Check, FormInput, SlidersHorizontal, Settings } from 'lucide-react';
const steps = [
{ id: 1, title: 'Select Material', icon: FormInput },
{ id: 2, title: 'Configure Paper', icon: SlidersHorizontal },
{ id: 3, title: 'Final Details', icon: Settings },
];
export const StepIndicator = () => {
const { step, setStep } = useGenerate();
return (
<div className="w-full mb-10 px-2 sm:px-6">
<div className="flex items-start justify-between relative">
<div className="absolute left-12 right-12 sm:left-16 sm:right-16 top-6 -translate-y-1/2 h-1.5 bg-slate-200 dark:bg-slate-800 rounded-full z-0 overflow-hidden">
<motion.div
className="h-full bg-gradient-to-r from-[#8B5CF6] to-[#4F7CFF]"
initial={{ width: '0%' }}
animate={{ width: `${((step - 1) / (steps.length - 1)) * 100}%` }}
transition={{ duration: 0.5, ease: 'easeInOut' }}
/>
</div>
{steps.map((s, i) => {
const isActive = step === s.id;
const isCompleted = step > s.id;
return (
<div
key={s.id}
className={`relative z-10 flex flex-col items-center gap-3 w-24 sm:w-32 transition-opacity duration-300 ${s.id < step ? 'cursor-pointer hover:opacity-80 hover:scale-105' : ''}`}
onClick={() => {
if (s.id < step) setStep(s.id);
}}
>
<motion.div
className={`w-12 h-12 rounded-full flex items-center justify-center border-[5px] shadow-sm transition-colors duration-300 ${isActive || isCompleted ? 'bg-gradient-to-br from-[#4F7CFF] to-[#8B5CF6] border-white dark:border-[#0F172A] text-white' : 'bg-white dark:bg-[#1E293B] text-slate-400 dark:text-slate-500 border-white dark:border-[#0F172A]'}`}
animate={{ scale: isActive ? 1.15 : 1 }}
>
{isCompleted ? <Check size={20} strokeWidth={3} /> : <s.icon size={20} />}
</motion.div>
<span className={`text-[11px] sm:text-xs font-bold text-center tracking-wide ${isActive ? 'text-[#4F7CFF] dark:text-[#8B5CF6]' : 'text-slate-500 dark:text-slate-400'}`}>
{s.title}
</span>
</div>
);
})}
</div>
</div>
);
};