|
1 | 1 | "use client"; |
2 | 2 |
|
3 | | -import { motion } from "framer-motion"; |
4 | | -import { fadeInOutDownToUp } from "@/components/FramerAnimation/Framer"; |
| 3 | +import { useEffect, useRef } from "react"; |
5 | 4 | import { SectionWrapper } from "@/components/shared/home"; |
6 | 5 | import { User, MessageSquare, UserCheck, Handshake } from "lucide-react"; |
7 | 6 |
|
| 7 | +// ─── Static per-card color classes (dynamic Tailwind classes fail at build) ─── |
| 8 | +// Each card gets explicit static classes instead of `text-${color}` interpolation. |
8 | 9 | const hiringSteps = [ |
9 | 10 | { |
10 | 11 | id: 1, |
11 | 12 | step: "01", |
12 | 13 | title: "Tell Us Your Needs", |
13 | | - description: "Share your project requirements, tech stack preferences, timeline, and team size. We'll help you define the perfect developer profile for your project.", |
| 14 | + description: |
| 15 | + "Share your project requirements, tech stack preferences, timeline, and team size. We'll help you define the perfect developer profile for your project.", |
14 | 16 | icon: MessageSquare, |
15 | | - color: "customTeal" |
| 17 | + // Static Tailwind classes — no interpolation |
| 18 | + iconBg: "bg-teal-500/10", |
| 19 | + iconColor: "text-teal-400", |
| 20 | + stepColor: "text-teal-400", |
16 | 21 | }, |
17 | 22 | { |
18 | 23 | id: 2, |
19 | | - step: "02", |
| 24 | + step: "02", |
20 | 25 | title: "Meet Pre-Vetted Talent", |
21 | | - description: "We present 3-5 carefully selected CoDevs who match your criteria. Each developer has been thoroughly vetted for technical skills and communication abilities.", |
| 26 | + description: |
| 27 | + "We present 3-5 carefully selected CoDevs who match your criteria. Each developer has been thoroughly vetted for technical skills and communication abilities.", |
22 | 28 | icon: User, |
23 | | - color: "customViolet-100" |
| 29 | + iconBg: "bg-violet-500/10", |
| 30 | + iconColor: "text-violet-400", |
| 31 | + stepColor: "text-violet-400", |
24 | 32 | }, |
25 | 33 | { |
26 | 34 | id: 3, |
27 | 35 | step: "03", |
28 | 36 | title: "Interview & Select", |
29 | | - description: "Conduct interviews with your shortlisted candidates. We facilitate the process and provide technical assessments to help you make the best choice.", |
| 37 | + description: |
| 38 | + "Conduct interviews with your shortlisted candidates. We facilitate the process and provide technical assessments to help you make the best choice.", |
30 | 39 | icon: UserCheck, |
31 | | - color: "customBlue-100" |
| 40 | + iconBg: "bg-blue-500/10", |
| 41 | + iconColor: "text-blue-400", |
| 42 | + stepColor: "text-blue-400", |
32 | 43 | }, |
33 | 44 | { |
34 | 45 | id: 4, |
35 | 46 | step: "04", |
36 | 47 | title: "Start Building", |
37 | | - description: "Your selected CoDevs integrate seamlessly with your team. We provide ongoing support to ensure successful project delivery and smooth collaboration.", |
| 48 | + description: |
| 49 | + "Your selected CoDevs integrate seamlessly with your team. We provide ongoing support to ensure successful project delivery and smooth collaboration.", |
38 | 50 | icon: Handshake, |
39 | | - color: "purple-500" |
40 | | - } |
| 51 | + iconBg: "bg-purple-500/10", |
| 52 | + iconColor: "text-purple-400", |
| 53 | + stepColor: "text-purple-400", |
| 54 | + }, |
41 | 55 | ]; |
42 | 56 |
|
43 | | -const HiringStepCard = ({ |
44 | | - step, |
45 | | - index |
46 | | -}: { |
47 | | - step: typeof hiringSteps[0]; |
48 | | - index: number; |
49 | | -}) => { |
50 | | - const Icon = step.icon; |
51 | | - |
52 | | - return ( |
53 | | - <motion.div |
54 | | - variants={fadeInOutDownToUp} |
55 | | - initial="hidden" |
56 | | - whileInView="visible" |
57 | | - className="group relative" |
58 | | - > |
59 | | - {/* Connecting line for desktop */} |
60 | | - {index < hiringSteps.length - 1 && ( |
61 | | - <div className="absolute -right-8 top-16 hidden h-0.5 w-16 bg-gradient-to-r from-purple-500 to-purple-300 lg:block" /> |
62 | | - )} |
63 | | - |
64 | | - <div className="relative overflow-hidden rounded-xl border border-gray-800 bg-gray-900/50 p-6 backdrop-blur-sm transition-all duration-300 hover:border-gray-600 hover:bg-gray-900/70"> |
65 | | - <div className="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-transparent to-blue-900/20 opacity-0 transition-opacity duration-300 group-hover:opacity-100" /> |
66 | | - |
67 | | - <div className="relative z-10"> |
68 | | - {/* Step number and icon */} |
69 | | - <div className="mb-4 flex items-center gap-4"> |
70 | | - <div className={`rounded-lg bg-${step.color}/10 p-3`}> |
71 | | - <Icon className={`h-6 w-6 text-${step.color}`} /> |
72 | | - </div> |
73 | | - <span className={`text-2xl font-bold text-${step.color}`}> |
74 | | - {step.step} |
75 | | - </span> |
76 | | - </div> |
| 57 | +// Staggered vertical offsets for alternating layout (cards 1&3 up, 2&4 down) |
| 58 | +// Matches the design reference wave pattern |
| 59 | +const STAGGER_OFFSETS = ["mt-0", "mt-16", "mt-0", "mt-16"]; |
77 | 60 |
|
78 | | - {/* Title and description */} |
79 | | - <h3 className="mb-3 text-xl font-semibold text-white"> |
80 | | - {step.title} |
81 | | - </h3> |
82 | | - <p className="text-sm text-gray-300 leading-relaxed"> |
83 | | - {step.description} |
84 | | - </p> |
85 | | - </div> |
86 | | - </div> |
87 | | - </motion.div> |
88 | | - ); |
89 | | -}; |
| 61 | +// Animation delay per card for cascading reveal (0ms, 200ms, 400ms, 600ms) |
| 62 | +const ANIMATION_DELAYS = [0, 200, 400, 600]; |
90 | 63 |
|
91 | 64 | const HiringProcess = () => { |
| 65 | + // Ref to the cards container — used to attach IntersectionObserver |
| 66 | + const sectionRef = useRef<HTMLDivElement>(null); |
| 67 | + |
| 68 | + useEffect(() => { |
| 69 | + const cards = sectionRef.current?.querySelectorAll<HTMLElement>("[data-card]"); |
| 70 | + if (!cards) return; |
| 71 | + |
| 72 | + // IntersectionObserver fires animation only when section enters viewport |
| 73 | + // (task requirement: no animation on load before section is visible) |
| 74 | + const observer = new IntersectionObserver( |
| 75 | + (entries) => { |
| 76 | + entries.forEach((entry) => { |
| 77 | + if (entry.isIntersecting) { |
| 78 | + const card = entry.target as HTMLElement; |
| 79 | + const delay = card.dataset.delay ?? "0"; |
| 80 | + |
| 81 | + // Apply visible class after delay — triggers CSS transition |
| 82 | + setTimeout(() => { |
| 83 | + card.classList.add("opacity-100", "translate-y-0"); |
| 84 | + card.classList.remove("opacity-0", "translate-y-8"); |
| 85 | + }, Number(delay)); |
| 86 | + |
| 87 | + // Stop observing once animated — each card animates once |
| 88 | + observer.unobserve(card); |
| 89 | + } |
| 90 | + }); |
| 91 | + }, |
| 92 | + { threshold: 0.15 } // Fire when 15% of card is visible |
| 93 | + ); |
| 94 | + |
| 95 | + cards.forEach((card) => observer.observe(card)); |
| 96 | + |
| 97 | + return () => observer.disconnect(); |
| 98 | + }, []); |
| 99 | + |
92 | 100 | return ( |
93 | 101 | <SectionWrapper className="relative lg:w-full lg:overflow-hidden py-20"> |
94 | 102 | <div className="relative z-10 mx-auto max-w-7xl px-6"> |
95 | | - {/* Section Header */} |
96 | | - <motion.div |
97 | | - variants={fadeInOutDownToUp} |
98 | | - initial="hidden" |
99 | | - whileInView="visible" |
100 | | - className="mb-12 text-center" |
101 | | - > |
| 103 | + |
| 104 | + {/* ── Section Header ── */} |
| 105 | + <div className="mb-16 text-center"> |
102 | 106 | <span className="inline-flex items-center gap-2 rounded-full border border-purple-400/40 bg-purple-500/10 px-4 py-1 text-xs font-medium uppercase tracking-[0.3em] text-purple-200 mb-4"> |
103 | 107 | Hiring Process |
104 | 108 | </span> |
105 | 109 | <h2 className="mb-4 text-4xl font-light tracking-tight text-white"> |
106 | 110 | How to Hire CoDevs |
107 | 111 | </h2> |
108 | 112 | <p className="text-lg text-gray-400 max-w-3xl mx-auto"> |
109 | | - Our streamlined process makes it easy to find and hire the perfect developers |
110 | | - for your project. From initial consultation to project delivery, we're with you every step of the way. |
| 113 | + Our streamlined process makes it easy to find and hire the perfect developers |
| 114 | + for your project. From initial consultation to project delivery, we're with you every step of the way. |
111 | 115 | </p> |
112 | | - </motion.div> |
| 116 | + </div> |
| 117 | + |
| 118 | + {/* ── Desktop: Staggered alternating layout ── */} |
| 119 | + <div ref={sectionRef} className="hidden lg:block relative"> |
| 120 | + |
| 121 | + {/* SVG connector path linking all 4 cards */} |
| 122 | + {/* Rendered behind cards (z-0), cards sit on z-10 */} |
| 123 | + <svg |
| 124 | + aria-hidden="true" |
| 125 | + className="absolute inset-0 w-full h-full pointer-events-none z-0" |
| 126 | + preserveAspectRatio="none" |
| 127 | + viewBox="0 0 1200 220" |
| 128 | + > |
| 129 | + <defs> |
| 130 | + {/* Glow gradient matching design reference purple/teal flow line */} |
| 131 | + <linearGradient id="connectorGradient" x1="0%" y1="0%" x2="100%" y2="0%"> |
| 132 | + <stop offset="0%" stopColor="#14b8a6" stopOpacity="0.8" /> |
| 133 | + <stop offset="50%" stopColor="#8b5cf6" stopOpacity="0.8" /> |
| 134 | + <stop offset="100%" stopColor="#14b8a6" stopOpacity="0.8" /> |
| 135 | + </linearGradient> |
| 136 | + {/* Blur filter for the glow effect */} |
| 137 | + <filter id="glow"> |
| 138 | + <feGaussianBlur stdDeviation="2" result="coloredBlur" /> |
| 139 | + <feMerge> |
| 140 | + <feMergeNode in="coloredBlur" /> |
| 141 | + <feMergeNode in="SourceGraphic" /> |
| 142 | + </feMerge> |
| 143 | + </filter> |
| 144 | + </defs> |
| 145 | + {/* |
| 146 | + Curved path connecting card centers in the staggered layout: |
| 147 | + Card 1 center ≈ x=150, y=80 (top row) |
| 148 | + Card 2 center ≈ x=450, y=140 (bottom row, +64px offset) |
| 149 | + Card 3 center ≈ x=750, y=80 (top row) |
| 150 | + Card 4 center ≈ x=1050, y=140 (bottom row) |
| 151 | + Uses cubic bezier curves for smooth wave |
| 152 | + */} |
| 153 | + <path |
| 154 | + d="M 150 80 C 250 80, 350 140, 450 140 S 650 80, 750 80 S 950 140, 1050 140" |
| 155 | + fill="none" |
| 156 | + stroke="url(#connectorGradient)" |
| 157 | + strokeWidth="1.5" |
| 158 | + filter="url(#glow)" |
| 159 | + /> |
| 160 | + </svg> |
113 | 161 |
|
114 | | - {/* Desktop Layout - Horizontal */} |
115 | | - <div className="hidden lg:grid lg:grid-cols-4 lg:gap-8"> |
116 | | - {hiringSteps.map((step, index) => ( |
117 | | - <HiringStepCard key={step.id} step={step} index={index} /> |
118 | | - ))} |
| 162 | + {/* Cards grid — staggered via mt offsets */} |
| 163 | + <div className="relative z-10 grid grid-cols-4 gap-8 items-start"> |
| 164 | + {hiringSteps.map((step, index) => { |
| 165 | + const Icon = step.icon; |
| 166 | + return ( |
| 167 | + <div |
| 168 | + key={step.id} |
| 169 | + // data-card: selector for IntersectionObserver |
| 170 | + // data-delay: staggered animation delay in ms |
| 171 | + data-card |
| 172 | + data-delay={ANIMATION_DELAYS[index]} |
| 173 | + className={` |
| 174 | + group relative |
| 175 | + ${STAGGER_OFFSETS[index]} |
| 176 | + opacity-0 translate-y-8 |
| 177 | + transition-all duration-700 ease-out |
| 178 | + `} |
| 179 | + > |
| 180 | + {/* Glassmorphism card — semi-transparent dark bg, subtle border */} |
| 181 | + <div className="relative overflow-hidden rounded-xl border border-white/10 bg-white/5 p-6 backdrop-blur-sm transition-all duration-300 hover:border-white/20 hover:bg-white/8"> |
| 182 | + |
| 183 | + {/* Hover glow overlay */} |
| 184 | + <div className="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-transparent to-blue-900/20 opacity-0 transition-opacity duration-300 group-hover:opacity-100 rounded-xl" /> |
| 185 | + |
| 186 | + <div className="relative z-10"> |
| 187 | + {/* Icon + step number row */} |
| 188 | + <div className="mb-4 flex items-center gap-4"> |
| 189 | + <div className={`rounded-lg ${step.iconBg} p-3`}> |
| 190 | + <Icon className={`h-6 w-6 ${step.iconColor}`} /> |
| 191 | + </div> |
| 192 | + <span className={`text-2xl font-bold ${step.stepColor}`}> |
| 193 | + {step.step} |
| 194 | + </span> |
| 195 | + </div> |
| 196 | + |
| 197 | + {/* Title */} |
| 198 | + <h3 className="mb-3 text-xl font-semibold text-white"> |
| 199 | + {step.title} |
| 200 | + </h3> |
| 201 | + |
| 202 | + {/* Description */} |
| 203 | + <p className="text-sm text-gray-300 leading-relaxed"> |
| 204 | + {step.description} |
| 205 | + </p> |
| 206 | + </div> |
| 207 | + </div> |
| 208 | + </div> |
| 209 | + ); |
| 210 | + })} |
| 211 | + </div> |
119 | 212 | </div> |
120 | 213 |
|
121 | | - {/* Mobile/Tablet Layout - Vertical */} |
| 214 | + {/* ── Mobile/Tablet: Single column vertical stack ── */} |
| 215 | + {/* Animations preserved — same IntersectionObserver targets [data-card] */} |
122 | 216 | <div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:hidden"> |
123 | | - {hiringSteps.map((step, index) => ( |
124 | | - <HiringStepCard key={step.id} step={step} index={index} /> |
125 | | - ))} |
| 217 | + {hiringSteps.map((step, index) => { |
| 218 | + const Icon = step.icon; |
| 219 | + return ( |
| 220 | + <div |
| 221 | + key={step.id} |
| 222 | + data-card |
| 223 | + data-delay={ANIMATION_DELAYS[index]} |
| 224 | + className="group relative opacity-0 translate-y-8 transition-all duration-700 ease-out" |
| 225 | + > |
| 226 | + <div className="relative overflow-hidden rounded-xl border border-white/10 bg-white/5 p-6 backdrop-blur-sm transition-all duration-300 hover:border-white/20"> |
| 227 | + <div className="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-transparent to-blue-900/20 opacity-0 transition-opacity duration-300 group-hover:opacity-100 rounded-xl" /> |
| 228 | + |
| 229 | + <div className="relative z-10"> |
| 230 | + <div className="mb-4 flex items-center gap-4"> |
| 231 | + <div className={`rounded-lg ${step.iconBg} p-3`}> |
| 232 | + <Icon className={`h-6 w-6 ${step.iconColor}`} /> |
| 233 | + </div> |
| 234 | + <span className={`text-2xl font-bold ${step.stepColor}`}> |
| 235 | + {step.step} |
| 236 | + </span> |
| 237 | + </div> |
| 238 | + <h3 className="mb-3 text-xl font-semibold text-white"> |
| 239 | + {step.title} |
| 240 | + </h3> |
| 241 | + <p className="text-sm text-gray-300 leading-relaxed"> |
| 242 | + {step.description} |
| 243 | + </p> |
| 244 | + </div> |
| 245 | + </div> |
| 246 | + </div> |
| 247 | + ); |
| 248 | + })} |
126 | 249 | </div> |
127 | 250 |
|
128 | | - {/* Call to Action */} |
129 | | - <motion.div |
130 | | - variants={fadeInOutDownToUp} |
131 | | - initial="hidden" |
132 | | - whileInView="visible" |
133 | | - className="mt-16 text-center" |
134 | | - > |
| 251 | + {/* ── Call to Action (unchanged from original) ── */} |
| 252 | + <div className="mt-16 text-center"> |
135 | 253 | <h3 className="mb-4 text-2xl font-semibold text-white"> |
136 | 254 | Ready to Build Your Dream Team? |
137 | 255 | </h3> |
138 | 256 | <p className="mb-6 text-gray-300 max-w-2xl mx-auto"> |
139 | | - Start your hiring journey today. Get matched with skilled developers |
| 257 | + Start your hiring journey today. Get matched with skilled developers |
140 | 258 | who can bring your vision to life. |
141 | 259 | </p> |
142 | 260 | <div className="flex flex-col gap-4 items-center sm:flex-row sm:justify-center"> |
143 | | - <a |
144 | | - href="/contact" |
| 261 | + <a |
| 262 | + href="/contact" |
145 | 263 | className="inline-flex items-center justify-center rounded-full bg-customViolet-100 px-8 py-3 text-sm font-medium text-white transition-all hover:bg-customViolet-100/90" |
146 | 264 | > |
147 | 265 | Start Hiring Process |
148 | 266 | </a> |
149 | | - <a |
150 | | - href="/bookacall" |
| 267 | + <a |
| 268 | + href="/bookacall" |
151 | 269 | className="inline-flex items-center justify-center rounded-full border border-customTeal/20 bg-customTeal/10 px-8 py-3 text-sm font-medium text-customTeal transition-all hover:bg-customTeal/20 hover:border-customTeal/40" |
152 | 270 | > |
153 | 271 | Schedule a Call |
154 | 272 | </a> |
155 | 273 | </div> |
156 | | - </motion.div> |
| 274 | + </div> |
157 | 275 | </div> |
158 | 276 |
|
159 | | - {/* Background decoration */} |
| 277 | + {/* Background decoration (unchanged from original) */} |
160 | 278 | <div |
161 | 279 | aria-hidden="true" |
162 | 280 | className="pointer-events-none absolute right-[20%] hidden transform-gpu overflow-hidden blur-3xl sm:-bottom-80 lg:block" |
|
0 commit comments