From 4ad2f2e2d3b96d0d6b7ba036c5a3467c2ed6a4bf Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Fri, 16 Aug 2024 00:40:35 +0100 Subject: [PATCH] Refactor project stepper --- src/components/Projects/ProjectStepper.tsx | 81 +++++++++++++++++----- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/src/components/Projects/ProjectStepper.tsx b/src/components/Projects/ProjectStepper.tsx index 027e0f56d..097f94bf0 100644 --- a/src/components/Projects/ProjectStepper.tsx +++ b/src/components/Projects/ProjectStepper.tsx @@ -1,7 +1,54 @@ -import { Flag, Hammer, Play, PlayCircle } from 'lucide-react'; +import { + Blocks, + Check, + Flag, + Hammer, + type LucideIcon, + Play, + PlayCircle, +} from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; import { cn } from '../../lib/classname.ts'; +type StepperActionProps = { + isActive?: boolean; + isCompleted?: boolean; + icon: LucideIcon; + text: string; + number: number; +}; + +function StepperAction(props: StepperActionProps) { + const { isActive, isCompleted, icon: DisplayIcon, text, number } = props; + + if (isActive) { + return ( + + ); + } + + if (isCompleted) { + return ( + + + {text} + + ); + } + + return ( + + + {number} + + {text} + + ); +} + export function ProjectStepper() { const stickyElRef = useRef(null); const [isSticky, setIsSticky] = useState(false); @@ -24,32 +71,32 @@ export function ProjectStepper() {
Start building, submit solution and get feedback from the community.
-
- +
+
- +