"use client"; import React, { useState, useEffect } from "react"; import ReCAPTCHA from "react-google-recaptcha"; import axios from "axios"; import Link from 'next/link'; export default function Hero() { const [formData, setFormData] = useState({ company: "", name: "", phone: "", email: "", product: "", city: "", quantity: "" }); const [formErrors, setFormErrors] = useState({}); const [captchaToken, setCaptchaToken] = useState(null); const [alert, setAlert] = useState({ show: false, type: "", message: "" }); const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setFormData((prev) => ({ ...prev, [name]: value })); }; const handleCaptchaChange = (token: string | null) => { setCaptchaToken(token); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); const errors: any = {}; if (!formData.name.trim()) errors.name = "Name is required."; if (!formData.phone.trim()) errors.phone = "Phone is required."; if (!formData.email.trim()) errors.email = "Email is required."; if (!formData.product.trim()) errors.product = "Please select a product."; if (!captchaToken) errors.captcha = "Please verify the CAPTCHA."; setFormErrors(errors); if (Object.keys(errors).length > 0) return; const emailData = { name: formData.name, email: formData.email, phone: formData.phone, message: ` Company: ${formData.company}
Product: ${formData.product}
Job Site City: ${formData.city}
Quantity: ${formData.quantity} `, to: "info@vgfenceproducts.com", senderName: "VG Fence Hero Form", recaptchaToken: captchaToken, }; setAlert({ show: true, type: "info", message: "Sending your request..." }); try { await axios.post("https://mailserver.metatronnest.com/send", emailData, { headers: { "Content-Type": "application/json" }, }); setAlert({ show: true, type: "success", message: "Thank you! Your quote request has been sent successfully.", }); setFormData({ company: "", name: "", phone: "", email: "", product: "", city: "", quantity: "" }); setCaptchaToken(null); setFormErrors({}); } catch (error) { console.error("❌ Error sending email:", error); setAlert({ show: true, type: "danger", message: "Failed to send request. Please try again later.", }); } }; useEffect(() => { if (alert.show && alert.type !== "info") { const timer = setTimeout(() => { setAlert((prev) => ({ ...prev, show: false })); }, 5000); return () => clearTimeout(timer); } }, [alert.show, alert.type]); return (
Kitchener–Waterloo Region · Ontario

Ontario's B2B
Fence Supply
Partner

Supplying contractors, builders, and property managers across Ontario with{' '} chain link, ornamental, composite, glass railing, and stain products — with same-day job site delivery across a 250km radius from KWC.

Request contractor pricing View all products
3+
Years serving KWC
250km
Delivery radius
9+
Product lines
B2B
Contractor focus
Request a quote
Response within 2 business hours · Contractor pricing available
{alert.show && (
{alert.message}
)}
{formErrors.captcha && {formErrors.captcha}}
Or call us directly · info@vgfenceproducts.com
); }