|
1 | 1 |
|
2 | | -import React from "react"; |
3 | | -import { Button } from "@/components/ui/button"; |
4 | | -import { Card, CardContent } from "@/components/ui/card"; |
| 2 | +import React, { useEffect } from "react"; |
| 3 | + |
| 4 | +declare global { |
| 5 | + interface Window { |
| 6 | + Tally?: { |
| 7 | + loadEmbeds: () => void; |
| 8 | + }; |
| 9 | + } |
| 10 | +} |
5 | 11 |
|
6 | 12 | const ContactSection = () => { |
| 13 | + useEffect(() => { |
| 14 | + const scriptUrl = "https://tally.so/widgets/embed.js"; |
| 15 | + if (!document.querySelector(`script[src="${scriptUrl}"]`)) { |
| 16 | + const script = document.createElement("script"); |
| 17 | + script.src = scriptUrl; |
| 18 | + script.onload = () => { |
| 19 | + if (typeof window.Tally !== "undefined") { |
| 20 | + window.Tally!.loadEmbeds(); |
| 21 | + } else { |
| 22 | + const iframes = document.querySelectorAll("iframe[data-tally-src]:not([src])") as NodeListOf<HTMLIFrameElement>; |
| 23 | + iframes.forEach((iframe) => { |
| 24 | + iframe.src = iframe.dataset.tallySrc!; |
| 25 | + }); |
| 26 | + } |
| 27 | + }; |
| 28 | + script.onerror = () => { |
| 29 | + const iframes = document.querySelectorAll("iframe[data-tally-src]:not([src])") as NodeListOf<HTMLIFrameElement>; |
| 30 | + iframes.forEach((iframe) => { |
| 31 | + iframe.src = iframe.dataset.tallySrc!; |
| 32 | + }); |
| 33 | + }; |
| 34 | + document.body.appendChild(script); |
| 35 | + } else { |
| 36 | + if (typeof window.Tally !== "undefined") { |
| 37 | + window.Tally!.loadEmbeds(); |
| 38 | + } else { |
| 39 | + const iframes = document.querySelectorAll("iframe[data-tally-src]:not([src])") as NodeListOf<HTMLIFrameElement>; |
| 40 | + iframes.forEach((iframe) => { |
| 41 | + iframe.src = iframe.dataset.tallySrc!; |
| 42 | + }); |
| 43 | + } |
| 44 | + } |
| 45 | + }, []); |
| 46 | + |
7 | 47 | return ( |
8 | | - <section id="contact" className="solar-section bg-solar-blue text-white"> |
| 48 | + <section id="contact" className="solar-section bg-gray-50 dark:bg-gray-900"> |
9 | 49 | <div className="solar-container"> |
10 | | - <div className="text-center max-w-3xl mx-auto mb-16"> |
11 | | - <h2 className="text-3xl md:text-4xl font-bold mb-6 md:mb-10">Visit Our Store</h2> |
12 | | - <p className="text-lg text-gray-100"> |
13 | | - Come see our products in person and speak with our solar experts. |
14 | | - We're here to help you find the perfect solar solution for your needs. |
15 | | - </p> |
16 | | - </div> |
17 | | - |
18 | | - <div className="grid md:grid-cols-2 gap-8 items-center"> |
19 | | - <Card className="bg-white text-solar-blue overflow-hidden"> |
20 | | - <CardContent className="p-0"> |
21 | | - <div className="aspect-[16/9]"> |
22 | | - {/* Replace with actual map or embedded Google Maps */} |
23 | | - <iframe |
24 | | - src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3022.215976753674!2d-73.9878584!3d40.7484405!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c259a9b3117469%3A0xd134e199a405a163!2sEmpire%20State%20Building!5e0!3m2!1sen!2sus!4v1590619166098!5m2!1sen!2sus" |
25 | | - width="100%" |
26 | | - height="100%" |
27 | | - style={{ border: 0 }} |
28 | | - allowFullScreen |
29 | | - loading="lazy" |
30 | | - title="Store Location" |
31 | | - ></iframe> |
32 | | - </div> |
33 | | - </CardContent> |
34 | | - </Card> |
35 | | - |
36 | | - <div className="bg-white text-solar-blue rounded-lg p-8"> |
37 | | - <h3 className="text-2xl font-bold mb-6">Store Information</h3> |
38 | | - <div className="space-y-4"> |
39 | | -{/* <div> |
40 | | - <p className="font-semibold">Address:</p> |
41 | | - <p>123 Solar Street, Greenville, CA 94536</p> |
42 | | - </div> |
43 | | - <div> |
44 | | - <p className="font-semibold">Hours:</p> |
45 | | - <p>Monday - Friday: 9:00 AM - 6:00 PM</p> |
46 | | - <p>Saturday: 10:00 AM - 4:00 PM</p> |
47 | | - <p>Sunday: Closed</p> |
48 | | - </div> |
49 | | - <div> |
50 | | - <p className="font-semibold">Phone:</p> |
51 | | - <p>(555) 123-4567</p> |
52 | | - </div> */} |
53 | | - <div> |
54 | | - <p className="font-semibold">Email:</p> |
55 | | - <p>contact@solveenergy.com</p> |
56 | | - </div> |
57 | | - <div className="pt-4"> |
58 | | - <Button className="bg-solar-gold hover:bg-opacity-90 text-solar-blue w-full"> |
59 | | - Get Directions |
60 | | - </Button> |
61 | | - </div> |
62 | | - </div> |
63 | | - </div> |
64 | | - </div> |
| 50 | + <iframe |
| 51 | + data-tally-src="https://tally.so/embed/QKoBLk?alignLeft=1&transparentBackground=1&dynamicHeight=1" |
| 52 | + loading="lazy" |
| 53 | + width="100%" |
| 54 | + height="1643" |
| 55 | + title="Contact us" |
| 56 | + ></iframe> |
65 | 57 | </div> |
66 | 58 | </section> |
67 | 59 | ); |
|
0 commit comments