This commit is contained in:
Vula Builder
2026-07-25 11:17:58 +00:00
parent 190a6bf9a9
commit 0ec90c4293
@@ -0,0 +1,175 @@
'use client'
import { useState } from "react"
import { Clock, Mail, MapPin, Phone } from 'lucide-react'
import Button from "@/components/ui/Button"
import Input from "@/components/ui/Input"
import { useEmDashContent } from "@/hooks/useEmDashContent"
export default function FindUsAndConnectSection() {
const { items, loading } = useEmDashContent("business_hours")
const [name, setName] = useState("")
const [email, setEmail] = useState("")
const [message, setMessage] = useState("")
const [submitted, setSubmitted] = useState(false)
if (loading) {
return (
<div className="flex justify-center py-16">
<div className="w-8 h-8 rounded-full border-2 border-current border-t-transparent animate-spin" />
</div>
)
}
if (items.length === 0) return null
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
setSubmitted(true)
setName("")
setEmail("")
setMessage("")
}
return (
<section
id="find-us"
data-vula-section="findusandconnect"
data-vula-cms="business_hours"
className="py-24 px-6"
style={{ backgroundColor: "#FDF6EC" }}
>
<div className="max-w-6xl mx-auto grid md:grid-cols-2 gap-12">
{/* Left: map placeholder + contact details + hours */}
<div>
<h2 className="text-3xl md:text-4xl font-bold mb-8" style={{ color: "#2C1810" }}>
Find Us & Connect
</h2>
<div className="rounded-xl overflow-hidden bg-white shadow-md mb-8">
<div className="h-48 w-full bg-[#E0D6C8] flex items-center justify-center text-[#2C1810]/60">
<MapPin className="w-8 h-8 mr-2" />
<span className="text-lg font-medium">Map Loaded Here</span>
</div>
</div>
<div className="space-y-4 mb-8">
<div className="flex items-start gap-3">
<MapPin className="w-5 h-5 mt-0.5" style={{ color: "#C0392B" }} />
<p style={{ color: "#2C1810" }}>
Masai Suites, Nairobi, Kenya
</p>
</div>
<div className="flex items-center gap-3">
<Phone className="w-5 h-5" style={{ color: "#C0392B" }} />
<p style={{ color: "#2C1810" }}>+254 712 345 678</p>
</div>
<div className="flex items-center gap-3">
<Mail className="w-5 h-5" style={{ color: "#C0392B" }} />
<p style={{ color: "#2C1810" }}>info@masaisuites.com</p>
</div>
</div>
<div className="rounded-xl overflow-hidden bg-white shadow-md p-5">
<div className="flex items-center gap-2 mb-4">
<Clock className="w-5 h-5" style={{ color: "#E67E22" }} />
<h3 className="font-semibold text-lg" style={{ color: "#2C1810" }}>
Opening Hours
</h3>
</div>
<ul className="space-y-2">
{items.map((item) => {
const d = item.data as {
day_of_week?: string
open_time?: string
close_time?: string
is_closed?: boolean
note?: string
}
return (
<li key={item.id} className="flex justify-between text-sm">
<span className="font-medium" style={{ color: "#2C1810" }}>
{d.day_of_week}
</span>
<span style={{ color: "#5a4a3f" }}>
{d.is_closed
? "Closed"
: `${d.open_time ?? "—"} ${d.close_time ?? "—"}`}
</span>
{d.note && (
<span className="text-xs italic" style={{ color: "#7a6a5f" }}>
{d.note}
</span>
)}
</li>
)
})}
</ul>
</div>
</div>
{/* Right: enquiry form */}
<div>
<div className="rounded-xl overflow-hidden bg-white shadow-md p-8">
<h3 className="text-xl font-semibold mb-6" style={{ color: "#2C1810" }}>
Send Us a Message
</h3>
{submitted ? (
<div className="text-center py-8">
<p className="text-lg font-medium" style={{ color: "#2C1810" }}>
Thank you! We will get back to you soon.
</p>
</div>
) : (
<form onSubmit={handleSubmit} className="space-y-5">
<div>
<label className="block text-sm font-medium mb-1" style={{ color: "#2C1810" }}>
Name
</label>
<Input
value={name}
onChange={(e) => setName(e.target.value)}
placeholder="Your name"
required
/>
</div>
<div>
<label className="block text-sm font-medium mb-1" style={{ color: "#2C1810" }}>
Email
</label>
<Input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="you@example.com"
required
/>
</div>
<div>
<label className="block text-sm font-medium mb-1" style={{ color: "#2C1810" }}>
Message
</label>
<textarea
value={message}
onChange={(e) => setMessage(e.target.value)}
placeholder="Your message..."
rows={4}
required
className="w-full rounded-lg border border-[#ddd5d4] bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[#C0392B]/40"
style={{ color: "#2C1810" }}
/>
</div>
<Button
type="submit"
variant="default"
size="lg"
className="w-full rounded-full"
style={{ backgroundColor: "#C0392B", color: "white", border: "none" }}
>
Send Message
</Button>
</form>
)}
</div>
</div>
</div>
</section>
)
}