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} /> + diff --git a/components/pages/home/banner.tsx b/components/pages/home/banner.tsx index e8b61ac..cad5c1c 100644 --- a/components/pages/home/banner.tsx +++ b/components/pages/home/banner.tsx @@ -1,8 +1,10 @@ -import { useTranslations } from "next-intl"; +import { useLocale, useTranslations } from "next-intl"; import DotAnimatsiya from "../../dot/DotAnimatsiya"; +import Link from "next/link"; export function Banner() { const t = useTranslations(); + const locale = useLocale(); return (
{/* Background Image */} @@ -77,8 +79,10 @@ export function Banner() { {/* Main Heading */} -

+

{t("home.banner.title2")}

@@ -88,9 +92,12 @@ export function Banner() {

{/* CTA Button */} - + diff --git a/components/pages/products/slug/rightSide.tsx b/components/pages/products/slug/rightSide.tsx index ffcac6c..c76802d 100644 --- a/components/pages/products/slug/rightSide.tsx +++ b/components/pages/products/slug/rightSide.tsx @@ -1,12 +1,5 @@ import { usePriceModalStore } from "@/store/useProceModalStore"; -import { Facebook, Share2 } from "lucide-react"; - -const socialLinks = [ - { name: "telegram", icon: "✈️", color: "#0088cc" }, - { name: "facebook", icon: , color: "#1877F2" }, - { name: "whatsapp", icon: "💬", color: "#25D366" }, - { name: "twitter", icon: "𝕏", color: "#1DA1F2" }, -]; +import { Instagram, Send, Share2 } from "lucide-react"; interface RightSideProps { id: number; @@ -95,19 +88,14 @@ export function RightSide({ Ulashish: -
- {socialLinks.map((social) => ( - - {social.icon} - - ))} -
+ diff --git a/components/provider/index.tsx b/components/provider/index.tsx index d658665..8df5fe9 100644 --- a/components/provider/index.tsx +++ b/components/provider/index.tsx @@ -14,7 +14,7 @@ export function Providers({ children }: { children: ReactNode }) { return (
- + {/* */} {children}