|
| 1 | +import { useState } from "react"; |
| 2 | +import { Github, Send, Wallet, X, Copy, Pencil } from "lucide-react"; |
| 3 | + |
| 4 | +const UserProfile = () => { |
| 5 | + const [username, setUsername] = useState("Luciferess"); |
| 6 | + const [email, setEmail] = useState("lulubae@gmail.com"); |
| 7 | + const [editingField, setEditingField] = useState<string | null>(null); |
| 8 | + const [address] = useState("0x742d...f44e"); |
| 9 | + |
| 10 | + return ( |
| 11 | + <div className="bg-zinc-900 rounded-xl p-8 max-w-sm mx-auto mt-8 shadow-lg flex flex-col items-center"> |
| 12 | + {/* Avatar */} |
| 13 | + <div className="w-20 h-20 rounded-full bg-yellow-200 flex items-center justify-center mb-4 text-5xl"> |
| 14 | + <img |
| 15 | + src="/assets/avatar.png" |
| 16 | + alt="avatar" |
| 17 | + className="w-full h-full rounded-full object-cover" |
| 18 | + /> |
| 19 | + </div> |
| 20 | + {/* Username */} |
| 21 | + <h2 className="text-xl font-semibold text-white mb-1"> |
| 22 | + {username} |
| 23 | + </h2> |
| 24 | + {/* Social icons */} |
| 25 | + <div className="flex gap-4 mb-4 text-zinc-400"> |
| 26 | + <Github size={20} className="hover:text-white cursor-pointer" /> |
| 27 | + <Send size={20} className="hover:text-white cursor-pointer" /> |
| 28 | + <Wallet size={20} className="hover:text-white cursor-pointer" /> |
| 29 | + <X size={20} className="hover:text-white cursor-pointer" /> |
| 30 | + </div> |
| 31 | + {/* Address row */} |
| 32 | + <div className="flex w-full gap-2 mb-4"> |
| 33 | + <button className="flex-1 bg-lime-200 text-black rounded px-3 py-2 font-mono flex items-center justify-between text-sm"> |
| 34 | + {address} |
| 35 | + <Copy size={16} className="ml-2" /> |
| 36 | + </button> |
| 37 | + <button |
| 38 | + className="flex-1 bg-zinc-800 text-zinc-400 rounded px-3 py-2 text-sm cursor-not-allowed" |
| 39 | + disabled |
| 40 | + > |
| 41 | + + Binding Address |
| 42 | + </button> |
| 43 | + </div> |
| 44 | + {/* Username field */} |
| 45 | + <div className="w-full mb-3"> |
| 46 | + <label className="text-xs text-zinc-400">Username</label> |
| 47 | + <div className="relative mt-1"> |
| 48 | + <input |
| 49 | + type="text" |
| 50 | + value={username} |
| 51 | + readOnly={editingField !== "username"} |
| 52 | + onChange={(e) => setUsername(e.target.value)} |
| 53 | + className="w-full bg-transparent border border-zinc-600 rounded px-3 py-2 text-white focus:outline-none focus:border-lime-200 transition pr-8" |
| 54 | + /> |
| 55 | + <button |
| 56 | + type="button" |
| 57 | + className="absolute right-2 top-1/2 -translate-y-1/2 text-zinc-400 hover:text-white" |
| 58 | + onClick={() => |
| 59 | + setEditingField( |
| 60 | + editingField === "username" ? null : "username" |
| 61 | + ) |
| 62 | + } |
| 63 | + > |
| 64 | + <Pencil size={16} /> |
| 65 | + </button> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + {/* Email field */} |
| 69 | + <div className="w-full"> |
| 70 | + <label className="text-xs text-zinc-400">Email address</label> |
| 71 | + <div className="relative mt-1"> |
| 72 | + <input |
| 73 | + type="email" |
| 74 | + value={email} |
| 75 | + readOnly={editingField !== "email"} |
| 76 | + onChange={(e) => setEmail(e.target.value)} |
| 77 | + className="w-full bg-transparent border border-zinc-600 rounded px-3 py-2 text-white focus:outline-none focus:border-lime-200 transition pr-8" |
| 78 | + /> |
| 79 | + <button |
| 80 | + type="button" |
| 81 | + className="absolute right-2 top-1/2 -translate-y-1/2 text-zinc-400 hover:text-white" |
| 82 | + onClick={() => |
| 83 | + setEditingField( |
| 84 | + editingField === "email" ? null : "email" |
| 85 | + ) |
| 86 | + } |
| 87 | + > |
| 88 | + <Pencil size={16} /> |
| 89 | + </button> |
| 90 | + </div> |
| 91 | + </div> |
| 92 | + </div> |
| 93 | + ); |
| 94 | +}; |
| 95 | + |
| 96 | +export default UserProfile; |
0 commit comments