'use client'; import { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; interface UsernameModalProps { isOpen: boolean; currentUsername: string; onUsernameChange: (username: string) => void; onClose: () => void; } export function UsernameModal({ isOpen, currentUsername, onUsernameChange, onClose }: UsernameModalProps) { const [username, setUsername] = useState(currentUsername); useEffect(() => { setUsername(currentUsername); }, [currentUsername]); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); if (username.trim()) { onUsernameChange(username.trim()); onClose(); } }; return ( {isOpen && ( <> {/* Backdrop */} {/* Modal */}
Choose Username Your username will be shown when you place pixels setUsername(e.target.value)} placeholder="Enter your username..." className="w-full px-3 sm:px-4 py-3 sm:py-3 bg-white/5 backdrop-blur-xl border border-white/20 rounded-xl text-white text-sm sm:text-base placeholder-white/50 focus:outline-none focus:border-blue-400/60 focus:bg-white/10 transition-all duration-200 ring-1 ring-white/10 touch-manipulation" maxLength={20} autoFocus /> Cancel Save
)}
); }