mirror of
http://88.130.71.182:3000/BlitTech/badoHair_fe.git
synced 2026-06-13 12:28:14 +00:00
111 lines
3.8 KiB
TypeScript
111 lines
3.8 KiB
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Input } from "@/components/ui/input";
|
|
import { Textarea } from "@/components/ui/textarea";
|
|
import { Label } from "@/components/ui/label";
|
|
import { useLanguage } from "@/contexts/LanguageContext";
|
|
import { submitContact } from "@/lib/api/contact";
|
|
import { ApiError } from "@/lib/api";
|
|
import { MapPin, Phone, Mail } from "lucide-react";
|
|
import { toast } from "sonner";
|
|
|
|
export default function Contact() {
|
|
const { t } = useLanguage();
|
|
const [name, setName] = useState("");
|
|
const [email, setEmail] = useState("");
|
|
const [message, setMessage] = useState("");
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
e.preventDefault();
|
|
setLoading(true);
|
|
try {
|
|
await submitContact(name, email, message);
|
|
toast.success(t("contact.success"));
|
|
setName("");
|
|
setEmail("");
|
|
setMessage("");
|
|
} catch (err) {
|
|
const msg = err instanceof ApiError ? err.message : t("contact.error");
|
|
toast.error(msg);
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div className="min-h-screen py-12 lg:py-20">
|
|
<div className="container mx-auto px-4 lg:px-8 max-w-5xl">
|
|
<h1 className="font-serif text-3xl lg:text-5xl text-center mb-12">{t("contact.title")}</h1>
|
|
|
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-12">
|
|
<div className="space-y-8">
|
|
<p className="text-muted-foreground leading-relaxed">{t("contact.description")}</p>
|
|
<div className="space-y-4">
|
|
<div className="flex items-center gap-3">
|
|
<MapPin className="h-5 w-5 text-primary" />
|
|
<span className="text-sm">123 Rue de la Beauté, 75001 Paris</span>
|
|
</div>
|
|
<div className="flex items-center gap-3">
|
|
<Phone className="h-5 w-5 text-primary" />
|
|
<span className="text-sm">+33 1 23 45 67 89</span>
|
|
</div>
|
|
<div className="flex items-center gap-3">
|
|
<Mail className="h-5 w-5 text-primary" />
|
|
<span className="text-sm">contact@luxehair.com</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="text-sm text-muted-foreground">
|
|
<h3 className="font-medium text-foreground mb-2">{t("contact.hours_title")}</h3>
|
|
<p>{t("contact.hours_weekdays")}</p>
|
|
<p>{t("contact.hours_saturday")}</p>
|
|
<p>{t("contact.hours_sunday")}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<form onSubmit={handleSubmit} className="space-y-4">
|
|
<div>
|
|
<Label htmlFor="name">{t("auth.name")}</Label>
|
|
<Input
|
|
id="name"
|
|
value={name}
|
|
onChange={(e) => setName(e.target.value)}
|
|
className="mt-1"
|
|
required
|
|
/>
|
|
</div>
|
|
<div>
|
|
<Label htmlFor="email">{t("auth.email")}</Label>
|
|
<Input
|
|
id="email"
|
|
type="email"
|
|
value={email}
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
className="mt-1"
|
|
required
|
|
/>
|
|
</div>
|
|
<div>
|
|
<Label htmlFor="message">{t("contact.message")}</Label>
|
|
<Textarea
|
|
id="message"
|
|
rows={5}
|
|
value={message}
|
|
onChange={(e) => setMessage(e.target.value)}
|
|
className="mt-1"
|
|
required
|
|
/>
|
|
</div>
|
|
<Button type="submit" className="w-full" size="lg" disabled={loading}>
|
|
{loading ? t("contact.sending") : t("contact.send")}
|
|
</Button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|