Skip to content

Commit a2cad6a

Browse files
authored
Merge pull request #87 from Dipanita45/prehjbhh
No Search or Quick Access Option
2 parents 0e537fc + 366e679 commit a2cad6a

2 files changed

Lines changed: 105 additions & 1 deletion

File tree

client/src/components/Footer.jsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Link, useLocation, useNavigate } from "react-router-dom";
2+
import { useState } from "react";
13
import { Link, useLocation } from "react-router-dom";
24
import {
35
FaGithub,
@@ -9,6 +11,18 @@ import {
911

1012
const Footer = () => {
1113
const location = useLocation();
14+
const navigate = useNavigate();
15+
16+
// ✅ Search state
17+
const [query, setQuery] = useState("");
18+
19+
// ✅ Handle search
20+
const handleSearch = () => {
21+
if (query.trim() !== "") {
22+
navigate(`/services?search=${query}`);
23+
setQuery("");
24+
}
25+
};
1226

1327
const linkClass = (path) =>
1428
`transition duration-200 ${
@@ -89,6 +103,7 @@ const Footer = () => {
89103
</ul>
90104
</div>
91105

106+
{/* Newsletter + Search */}
92107
{/* Newsletter */}
93108
<div className="lg:col-span-2">
94109
<h3 className="text-white font-semibold mb-4 tracking-wide">
@@ -99,6 +114,27 @@ const Footer = () => {
99114
Get updates on new services, offers, and features directly to your inbox.
100115
</p>
101116

117+
{/* 🔍 Footer Search */}
118+
<div className="mb-5">
119+
<div className="flex gap-2">
120+
<input
121+
type="text"
122+
placeholder="Search services..."
123+
value={query}
124+
onChange={(e) => setQuery(e.target.value)}
125+
onKeyDown={(e) => e.key === "Enter" && handleSearch()}
126+
className="w-full px-4 py-2 rounded-lg bg-gray-900 border border-gray-700 text-sm focus:outline-none focus:border-blue-400"
127+
/>
128+
<button
129+
onClick={handleSearch}
130+
className="px-4 py-2 rounded-lg bg-blue-500 hover:bg-blue-600 text-white text-sm transition"
131+
>
132+
🔍
133+
</button>
134+
</div>
135+
</div>
136+
137+
{/* Newsletter Form */}
102138
<form className="flex flex-col sm:flex-row gap-3">
103139
<input
104140
type="email"

client/src/pages/Home.jsx

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Link } from 'react-router-dom';
1+
import { Link, useNavigate } from 'react-router-dom';
2+
import { useState } from 'react';
23
import { useMemo } from 'react';
34
import { useLocation } from '../context/LocationContext';
45
import { getDistanceKm, formatDistance } from '../utils/distance';
@@ -245,6 +246,51 @@ const Home = () => {
245246
</div>
246247
</section>
247248

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"
248294
{/* Popular categories */}
249295
<section className="py-20 sm:py-24 bg-white">
250296
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@@ -278,6 +324,28 @@ const Home = () => {
278324
</div>
279325
</section>
280326

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 */}
281349
{/* Nearby (location-driven) */}
282350
{(geoLoading || coords || geoError) && (
283351
<section className="py-16 sm:py-20 bg-white">

0 commit comments

Comments
 (0)