import React, { useState } from 'react'; import { useAuth } from '../context/AuthContext'; import { useNavigate } from 'react-router-dom'; // Icons const CloseIcon = ({ className }) => ( ); const GoogleIcon = ({ className }) => ( ); const AtSignIcon = ({ className }) => ( ); const LockIcon = ({ className }) => ( ); const LoginModal = ({ onClose, onSignup }) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const { login, googleLogin } = useAuth(); const navigate = useNavigate(); const handleSubmit = async (e) => { e.preventDefault(); setError(''); setLoading(true); try { await login({ email, password }); onClose(); navigate('/dashboard'); } catch (err) { setError(err.response?.data?.message || 'Invalid email or password'); } finally { setLoading(false); } }; const handleGoogleLogin = () => { googleLogin(); }; return (
{/* Container echoing the AuthPage styling */}
{/* Background Gradients from provided code */}
{/* Close Button */}
{/* Header */}

Sign In

Welcome back to PopcornPing.

{/* Google Button */}
{/* Separator */}
OR
{/* Error Message */} {error && (
{error}
)} {/* Email Form */}
setEmail(e.target.value)} required className="flex h-10 w-full rounded-md border border-gray-700 bg-black px-3 py-2 pl-9 text-sm text-white placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-purple-600 focus:border-transparent transition-all" />
setPassword(e.target.value)} required className="flex h-10 w-full rounded-md border border-gray-700 bg-black px-3 py-2 pl-9 text-sm text-white placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-purple-600 focus:border-transparent transition-all" />
{/* Footer */}

Don't have an account?{' '}

); }; export default LoginModal;