File size: 1,338 Bytes
6a144bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// src/components/AuthModal.tsx

import React from 'react';
import { X } from 'lucide-react';

interface AuthModalProps {
  isOpen: boolean;
  onClose: () => void;
  children: React.ReactNode;
}

const AuthModal: React.FC<AuthModalProps> = ({ isOpen, onClose, children }) => {
  if (!isOpen) return null;

  return (
    // Backdrop/Overlay: Fixed position, full screen, dark, and translucent
    <div 
      className="fixed inset-0 z-[100] bg-black bg-opacity-80 backdrop-blur-sm flex items-center justify-center p-4 transition-opacity duration-300"
      onClick={onClose} // Close the modal when clicking outside
    >
      {/* Modal Content Container: Prevent closing when clicking on the form itself */}
      <div 
        className="relative w-full max-w-md bg-slate-900 border border-blue-500/30 rounded-xl shadow-2xl animate-fade-in-up" 
        onClick={(e) => e.stopPropagation()} 
      >
        {/* Close Button */}
        <button 
          className="absolute top-4 right-4 p-2 text-gray-400 hover:text-blue-400 transition-colors z-10"
          onClick={onClose}
        >
          <X className="w-6 h-6" />
        </button>
        
        {/* Children (SignIn or SignUp content) */}
        <div className="p-8 pt-10">
          {children}
        </div>
      </div>
    </div>
  );
};

export default AuthModal;