Skip to content

Commit ed69a7e

Browse files
authored
Merge pull request #109 from GoBuildOrg/dev2
Dev2
2 parents f852c31 + 1652c98 commit ed69a7e

2 files changed

Lines changed: 124 additions & 0 deletions

File tree

src/components/PopupWhatsApp.tsx

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import React, { useState } from "react";
2+
3+
type PopupWhatsAppProps = {
4+
phoneNumber: string;
5+
message?: string;
6+
};
7+
8+
const PopupWhatsApp: React.FC<PopupWhatsAppProps> = ({
9+
phoneNumber,
10+
message = "Hello GoBuild! I need some information regarding your services.",
11+
}) => {
12+
const [open, setOpen] = useState(false);
13+
14+
const whatsappLink = `https://wa.me/${8899310111}?text=${encodeURIComponent(
15+
message
16+
)}`;
17+
18+
return (
19+
<>
20+
{/* Floating Button */}
21+
<div
22+
onClick={() => setOpen(!open)}
23+
style={{
24+
position: "fixed",
25+
bottom: "20px",
26+
right: "20px",
27+
backgroundColor: "#25D366",
28+
width: "60px",
29+
height: "60px",
30+
borderRadius: "50%",
31+
display: "flex",
32+
alignItems: "center",
33+
justifyContent: "center",
34+
cursor: "pointer",
35+
boxShadow: "0 4px 10px rgba(0,0,0,0.3)",
36+
zIndex: 9999,
37+
animation: "bounce 1.5s infinite",
38+
transition: "0.3s ease",
39+
}}
40+
>
41+
{/* WhatsApp icon when closed */}
42+
{!open && (
43+
<img
44+
src="https://upload.wikimedia.org/wikipedia/commons/6/6b/WhatsApp.svg"
45+
alt="whatsapp"
46+
style={{ width: "32px", height: "32px" }}
47+
/>
48+
)}
49+
50+
{/* DOWN ARROW when popup is open */}
51+
{open && (
52+
<img
53+
src="https://cdn-icons-png.flaticon.com/512/2985/2985150.png"
54+
alt="down arrow"
55+
style={{
56+
width: "26px",
57+
height: "26px",
58+
filter: "brightness(0) invert(1)", // forces clean white
59+
}}
60+
/>
61+
)}
62+
63+
</div>
64+
65+
{/* Popup */}
66+
<div
67+
style={{
68+
position: "fixed",
69+
bottom: open ? "100px" : "-300px",
70+
right: "20px",
71+
width: "260px",
72+
background: "white",
73+
borderRadius: "12px",
74+
padding: "16px",
75+
boxShadow: "0 4px 20px rgba(0,0,0,0.2)",
76+
zIndex: 999,
77+
transition: "bottom 0.35s ease",
78+
}}
79+
>
80+
<p style={{ fontWeight: "bold", marginBottom: "4px" }}>Hi there!</p>
81+
82+
<a
83+
href={whatsappLink}
84+
target="_blank"
85+
rel="noopener noreferrer"
86+
style={{
87+
display: "flex",
88+
alignItems: "center",
89+
gap: "8px",
90+
background: "#25D366",
91+
color: "white",
92+
padding: "10px 16px",
93+
borderRadius: "8px",
94+
textDecoration: "none",
95+
justifyContent: "center",
96+
fontSize: "14px",
97+
boxShadow: "0 2px 6px rgba(0,0,0,0.2)",
98+
}}
99+
>
100+
<img
101+
src="https://upload.wikimedia.org/wikipedia/commons/6/6b/WhatsApp.svg"
102+
style={{ width: "20px" }}
103+
/>
104+
Chat with us
105+
</a>
106+
</div>
107+
108+
{/* Bounce Animation */}
109+
<style>
110+
{`
111+
@keyframes bounce {
112+
0%, 100% { transform: translateY(0); }
113+
50% { transform: translateY(-8px); }
114+
}
115+
`}
116+
</style>
117+
</>
118+
);
119+
};
120+
121+
export default PopupWhatsApp;

src/pages/Index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Bmodel from "@/components/Bmodel";
1515
import VideoTestimonials from "@/components/VideoTestimonials";
1616
import Solutions from "@/components/Solutions";
1717
import OfferRibbon from "@/components/OfferRibbon";
18+
import PopupWhatsApp from "@/components/PopupWhatsApp";
1819
// import { Banner } from "@/components/Banner";
1920

2021
const Index: React.FC = () => {
@@ -48,6 +49,7 @@ const Index: React.FC = () => {
4849

4950
return (
5051
<div className="min-h-screen bg-background">
52+
5153
<Navbar />
5254
<SEO title="Hire Verified Construction Labour Near You" description="Find and hire verified masons, carpenters, electricians and helpers in Jammu and Delhi. Trusted professionals for construction and repair work." keywords="hire construction workers, masons near me, carpenters near me, GoBuild" url="https://www.gobuild.in/" />
5355
<Hero />
@@ -63,6 +65,7 @@ const Index: React.FC = () => {
6365
<VideoTestimonials />
6466
<FAQ />
6567
{/* <FeaturedProfessionals /> */}
68+
<PopupWhatsApp/>
6669
<Footer />
6770
</div>
6871
);

0 commit comments

Comments
 (0)