import React from 'react';
import { useState } from 'react';

export default function LoginForm({ onLogin }) {
  const [password, setPassword] = useState('');

  const handleSubmit = (e) => {
    e.preventDefault();
    if (password === 'admin123') onLogin();
    else alert('Incorrect password');
  };

  return (
    <form onSubmit={handleSubmit} style={{ padding: '50px' }}>
      <h2>Admin Login</h2>
      <input
        type="password"
        placeholder="Enter password"
        value={password}
        onChange={(e) => setPassword(e.target.value)}
        style={{ padding: '8px', width: '200px' }}
      />
      <button type="submit" style={{ marginLeft: '10px' }}>Login</button>
    </form>
  );
}

