From b27cc055b0e7c314b1685acfcd94b3353809ff13 Mon Sep 17 00:00:00 2001 From: Samarth Prashar Date: Sat, 29 Nov 2025 14:54:10 +0530 Subject: [PATCH] integrated Whatsapp --- src/components/PopupWhatsApp.tsx | 121 +++++++++++++++++++++++++++++++ src/pages/Index.tsx | 3 + 2 files changed, 124 insertions(+) create mode 100644 src/components/PopupWhatsApp.tsx diff --git a/src/components/PopupWhatsApp.tsx b/src/components/PopupWhatsApp.tsx new file mode 100644 index 00000000..fdc43bd7 --- /dev/null +++ b/src/components/PopupWhatsApp.tsx @@ -0,0 +1,121 @@ +import React, { useState } from "react"; + +type PopupWhatsAppProps = { + phoneNumber: string; + message?: string; +}; + +const PopupWhatsApp: React.FC = ({ + phoneNumber, + message = "Hello GoBuild! I need some information regarding your services.", +}) => { + const [open, setOpen] = useState(false); + + const whatsappLink = `https://wa.me/${8899310111}?text=${encodeURIComponent( + message + )}`; + + return ( + <> + {/* Floating Button */} +
setOpen(!open)} + style={{ + position: "fixed", + bottom: "20px", + right: "20px", + backgroundColor: "#25D366", + width: "60px", + height: "60px", + borderRadius: "50%", + display: "flex", + alignItems: "center", + justifyContent: "center", + cursor: "pointer", + boxShadow: "0 4px 10px rgba(0,0,0,0.3)", + zIndex: 9999, + animation: "bounce 1.5s infinite", + transition: "0.3s ease", + }} + > + {/* WhatsApp icon when closed */} + {!open && ( + whatsapp + )} + + {/* DOWN ARROW when popup is open */} + {open && ( + down arrow +)} + +
+ + {/* Popup */} +
+

Hi there!

+ + + + Chat with us + +
+ + {/* Bounce Animation */} + + + ); +}; + +export default PopupWhatsApp; diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 4fcec1df..59cc14d0 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -15,6 +15,7 @@ import Bmodel from "@/components/Bmodel"; import VideoTestimonials from "@/components/VideoTestimonials"; import Solutions from "@/components/Solutions"; import OfferRibbon from "@/components/OfferRibbon"; +import PopupWhatsApp from "@/components/PopupWhatsApp"; // import { Banner } from "@/components/Banner"; const Index: React.FC = () => { @@ -48,6 +49,7 @@ const Index: React.FC = () => { return (
+ @@ -63,6 +65,7 @@ const Index: React.FC = () => { {/* */} +
);