|
1 | | -import { Link } from 'react-router-dom'; |
| 1 | +import { Link, useNavigate } from 'react-router-dom'; |
| 2 | +import { useState } from 'react'; |
2 | 3 | import { useMemo } from 'react'; |
3 | 4 | import { useLocation } from '../context/LocationContext'; |
4 | 5 | import { getDistanceKm, formatDistance } from '../utils/distance'; |
@@ -245,6 +246,51 @@ const Home = () => { |
245 | 246 | </div> |
246 | 247 | </section> |
247 | 248 |
|
| 249 | + {/* 🔍 Search Bar (Quick Access) */} |
| 250 | +<div className="mt-6 max-w-2xl mx-auto"> |
| 251 | + |
| 252 | + <div className="flex items-center bg-white shadow-md rounded-xl overflow-hidden border border-gray-200 focus-within:ring-2 focus-within:ring-blue-500 transition"> |
| 253 | + |
| 254 | + <input |
| 255 | + type="text" |
| 256 | + placeholder="Search services like Electrician, Plumber..." |
| 257 | + className="flex-1 px-5 py-3 outline-none text-gray-700" |
| 258 | + /> |
| 259 | + |
| 260 | + <Link |
| 261 | + to="/services" |
| 262 | + className="bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 font-medium transition" |
| 263 | + > |
| 264 | + Search |
| 265 | + </Link> |
| 266 | + |
| 267 | + </div> |
| 268 | + |
| 269 | + {/* ⚡ Quick Access Buttons */} |
| 270 | + <div className="mt-4 flex flex-wrap justify-center gap-3"> |
| 271 | + {["Electrician", "Plumber", "Cleaner", "AC Technician"].map((item) => ( |
| 272 | + <Link |
| 273 | + key={item} |
| 274 | + to={`/services?category=${item}`} |
| 275 | + className="px-4 py-2 bg-gray-100 hover:bg-blue-100 text-sm rounded-full transition" |
| 276 | + > |
| 277 | + {item} |
| 278 | + </Link> |
| 279 | + ))} |
| 280 | + </div> |
| 281 | + |
| 282 | +</div> |
| 283 | + |
| 284 | + <div className="mt-8 flex flex-col sm:flex-row justify-center gap-4"> |
| 285 | + <Link |
| 286 | + to="/services" |
| 287 | + className="inline-flex items-center justify-center px-8 py-3 text-base font-medium rounded-lg text-white bg-blue-600 hover:bg-blue-700 shadow-md hover:shadow-lg transition" |
| 288 | + > |
| 289 | + Browse Services |
| 290 | + </Link> |
| 291 | + <Link |
| 292 | + to="/worker-register" |
| 293 | + className="inline-flex items-center justify-center px-8 py-3 text-base font-medium rounded-lg text-blue-600 bg-white border border-gray-200 hover:bg-gray-50 shadow-sm hover:shadow-md transition" |
248 | 294 | {/* Popular categories */} |
249 | 295 | <section className="py-20 sm:py-24 bg-white"> |
250 | 296 | <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> |
@@ -278,6 +324,28 @@ const Home = () => { |
278 | 324 | </div> |
279 | 325 | </section> |
280 | 326 |
|
| 327 | + <h2 className="text-4xl font-bold text-gray-900 mb-4"> |
| 328 | + How It Works |
| 329 | + </h2> |
| 330 | + <p className="text-gray-500 mb-16"> |
| 331 | + Get your job done in 3 simple steps |
| 332 | + </p> |
| 333 | + |
| 334 | + <div className="max-w-6xl mx-auto mt-10 grid md:grid-cols-3 gap-8"> |
| 335 | + {[ |
| 336 | + { step: "1", title: "Search", desc: "Find skilled workers near you" }, |
| 337 | + { step: "2", title: "Book", desc: "Choose time and confirm instantly" }, |
| 338 | + { step: "3", title: "Relax", desc: "Get your job done stress-free" }, |
| 339 | + ].map((s) => ( |
| 340 | + <div key={s.step} className="p-6 border rounded-xl hover:shadow-lg transition"> |
| 341 | + <div className="text-blue-600 font-bold text-xl">{s.step}</div> |
| 342 | + <h3 className="font-semibold mt-2">{s.title}</h3> |
| 343 | + <p className="text-gray-500 mt-1">{s.desc}</p> |
| 344 | + </div> |
| 345 | + ))} |
| 346 | + </div> |
| 347 | + {/* ── Near You Section ── */} |
| 348 | + {/* Near You Section */} |
281 | 349 | {/* Nearby (location-driven) */} |
282 | 350 | {(geoLoading || coords || geoError) && ( |
283 | 351 | <section className="py-16 sm:py-20 bg-white"> |
|
0 commit comments