'use client'; import { useCallback, useState } from 'react'; import { X } from 'lucide-react'; import { formatPhone, normalizeDigits, } from '../../../../shared/lib/formatPhone'; import PhonePrefix from '../../../../shared/ui/phonePrefix'; import { MotionWrapper } from '../../../../shared/ui/motion'; import { useLoginForm } from '../lib/useLoginForm'; import { useLoginModal } from '@/shared/zustand/auth'; import Link from 'next/link'; export function LoginForm() { const [isFocused, setIsFocused] = useState(false); const { phone, setPhone, submit, error, loading } = useLoginForm(); const toggleLoginModal = useLoginModal((state) => state.toggleLoginModal); const handlePhoneChange = useCallback( (e: React.ChangeEvent) => { setPhone(normalizeDigits(e.target.value)); }, [setPhone], ); return ( <> {/* Backdrop */}
{/* Modal */}
{/* Close */}
{/* Header */}

Xush kelibsiz

Kirish

Telefon raqamingizni kiriting.

{/* Phone field */}
setIsFocused(true)} onBlur={() => setIsFocused(false)} className={` w-full rounded-sm border bg-stone-50 py-2.5 pl-30 pr-3.5 text-[0.95rem] font-medium text-stone-900 outline-none placeholder:text-stone-300 transition-all duration-150 ${ error ? 'border-red-400 ring-2 ring-red-200/40' : isFocused ? 'border-stone-400 ring-2 ring-stone-300/30' : 'border-stone-200 hover:border-stone-300' } `} />
{/* Digit counter / complete hint */}
{phone.length > 0 && `${phone.length} ta raqam kiritildi`} {phone.length === 9 && ( ✓ To‘liq )}
{/* Error */} {error && (
{error}
)} {/* Submit */} {/* Divider */}
yoki
{/* Register hint */}

Hisobingiz yo‘qmi? Ro‘yxatdan o‘tish

); }