From dcdfce4d792e453781ca7bceb80d483d8d95d9bc Mon Sep 17 00:00:00 2001 From: "nabijonovdavronbek619@gmail.com" Date: Mon, 9 Feb 2026 19:21:22 +0500 Subject: [PATCH] contact form updated , added telegram instagram icon buttons --- components/layout/footer.tsx | 62 ++++++++++++++++---- components/pages/contact/form.tsx | 52 ++++++++++++---- components/pages/contact/main.tsx | 2 +- components/pages/home/about.tsx | 10 ++-- components/pages/home/banner.tsx | 17 ++++-- components/pages/products/slug/rightSide.tsx | 30 +++------- components/provider/index.tsx | 2 +- 7 files changed, 118 insertions(+), 57 deletions(-) diff --git a/components/layout/footer.tsx b/components/layout/footer.tsx index 790edba..3f5a045 100644 --- a/components/layout/footer.tsx +++ b/components/layout/footer.tsx @@ -3,18 +3,18 @@ import React from "react"; import { useState } from "react"; -import { Mail, Phone, MapPin } from "lucide-react"; +import { Mail, Phone, MapPin, Instagram, Send } from "lucide-react"; import { useLocale, useTranslations } from "next-intl"; import Image from "next/image"; import Link from "next/link"; import { useMutation } from "@tanstack/react-query"; import { toast } from "react-toastify"; -import axios from "axios"; import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; export function Footer() { const locale = useLocale(); + const [errors, setErrors] = useState({}); const t = useTranslations(); const [email, setEmail] = useState(""); const [subscribed, setSubscribed] = useState(false); @@ -34,6 +34,30 @@ export function Footer() { }, }); + const formatPhoneNumber = (value: string) => { + const numbers = value.replace(/\D/g, ""); + if (!numbers.startsWith("998")) { + return "+998 "; + } + + let formatted = "+998 "; + const rest = numbers.slice(3); + if (rest.length > 0) formatted += rest.slice(0, 2); + if (rest.length > 2) formatted += " " + rest.slice(2, 5); + if (rest.length > 5) formatted += " " + rest.slice(5, 7); + if (rest.length > 7) formatted += " " + rest.slice(7, 9); + + return formatted; + }; + + const handlePhoneChange = (e: React.ChangeEvent) => { + const formatted = formatPhoneNumber(e.target.value); + setEmail(formatted); + if (errors.address) { + setErrors({ ...errors, address: "" }); + } + }; + const handleSubscribe = (e: React.FormEvent) => { e.preventDefault(); if (email) { @@ -67,14 +91,16 @@ export function Footer() { className="flex sm:flex-row flex-col w-full gap-2 md:w-auto" > setEmail(e.target.value)} - className="font-almarai flex-1 rounded-full bg-white px-6 py-3 text-gray-800 placeholder-gray-400 focus:outline-none md:w-64" - required + onChange={handlePhoneChange} + className={`font-almarai w-full rounded-3xl border bg-white px-4 py-3 text-sm text-gray-700 placeholder-gray-400 outline-none transition focus:ring-2 focus:ring-red-500 ${ + errors.email ? "border-red-500" : "border-transparent" + }`} + placeholder="+998 90 123 45 67" + maxLength={17} /> {t("footer.description")}
- {errors.address} -
{errors.address}