diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index e199bf2..9d8fd84 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -7,7 +7,8 @@ import "./styles/base.css";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
- title: "CoreScale - Professional Websites for Small Businesses", description: "Affordable professional websites for small and local businesses. Build trust, attract customers, and grow your business online with CoreScale."};
+ title: "CoreScale - Professional Websites for Small Businesses", description: "Affordable professional websites for small and local businesses. Build trust, attract customers, and grow your business online with CoreScale."
+};
export default function RootLayout({
children,
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 2cffd36..8d2e2a1 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -13,7 +13,8 @@ import { useState } from "react";
export default function LandingPage() {
const [submitted, setSubmitted] = useState(false);
const [formData, setFormData] = useState({
- fullName: "", businessName: "", email: "", phone: "", message: ""});
+ fullName: "", businessName: "", email: "", phone: "", message: ""
+ });
const handlePhoneClick = () => {
window.location.href = "tel:206-741-9017";
@@ -23,12 +24,45 @@ export default function LandingPage() {
window.location.href = "mailto:CoreScale.co@gmail.com";
};
- const handleFormSubmit = (e: React.FormEvent) => {
+ const handleFormSubmit = async (e: React.FormEvent) => {
e.preventDefault();
- setSubmitted(true);
- setFormData({
- fullName: "", businessName: "", email: "", phone: "", message: ""});
- setTimeout(() => setSubmitted(false), 5000);
+
+ // Prepare email content
+ const emailBody = `New Website Request from CoreScale Contact Form\n\n${
+ "==".repeat(40)
+ }\n\nFull Name: ${formData.fullName}\nBusiness Name: ${formData.businessName}\nEmail Address: ${formData.email}\nPhone Number: ${formData.phone}\nMessage: ${formData.message}\n\n${
+ "==".repeat(40)
+ }`;
+
+ try {
+ // Send email using Formspree or similar service
+ const response = await fetch("https://formspree.io/f/mpwazqqq", {
+ method: "POST", headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify({
+ name: formData.fullName,
+ email: formData.email,
+ businessName: formData.businessName,
+ phone: formData.phone,
+ message: formData.message,
+ _subject: "New Website Request \u2013 CoreScale", _reply_to: formData.email
+ })
+ });
+
+ if (response.ok) {
+ setSubmitted(true);
+ setFormData({
+ fullName: "", businessName: "", email: "", phone: "", message: ""
+ });
+ setTimeout(() => setSubmitted(false), 5000);
+ } else {
+ alert("Failed to send form. Please try again.");
+ }
+ } catch (error) {
+ console.error("Error submitting form:", error);
+ alert("An error occurred. Please try again.");
+ }
};
const handleInputChange = (
@@ -36,7 +70,7 @@ export default function LandingPage() {
) => {
setFormData({
...formData,
- [e.target.name]: e.target.value,
+ [e.target.name]: e.target.value
});
};
@@ -60,10 +94,11 @@ export default function LandingPage() {
{ name: "About", id: "about" },
{ name: "Services", id: "services" },
{ name: "Why We Matter", id: "why-matters" },
- { name: "Contact", id: "contact" },
+ { name: "Contact", id: "contact" }
]}
button={{
- text: "Get Your Website Today", href: "contact"}}
+ text: "Get Your Website Today", href: "contact"
+ }}
animateOnLoad={true}
/>
@@ -81,7 +116,7 @@ export default function LandingPage() {
showDimOverlay={false}
buttons={[
{ text: "Get Your Website Today", href: "contact" },
- { text: "Learn More", href: "about" },
+ { text: "Learn More", href: "about" }
]}
buttonAnimation="slide-up"
/>
@@ -91,7 +126,8 @@ export default function LandingPage() {
- Thank you for contacting CoreScale. + Thank you for contacting CoreScale. We will reach out to you shortly.
- We will reach out shortly to discuss your website. + We've received your website request and will be in touch soon to discuss your project.