|
| 1 | +"use client"; |
| 2 | +import React from "react"; |
| 3 | +import Image from "next/image"; |
| 4 | + |
| 5 | +interface ProfileCardProps { |
| 6 | + name: string; |
| 7 | + email: string; |
| 8 | + totalScore: number; |
| 9 | + maxScore: number; |
| 10 | +} |
| 11 | + |
| 12 | +const ProfileCard: React.FC<ProfileCardProps> = ({ name, email, totalScore, maxScore }) => { |
| 13 | + const progress = (totalScore / maxScore) * 100; |
| 14 | + |
| 15 | + return ( |
| 16 | + <div className="w-75 rounded-lg bg-neutral-900 text-gray-200 shadow-md overflow-hidden border border-gray-700"> |
| 17 | + {/* Header strip */} |
| 18 | + <div className="bg-neutral-800 text-center py-2"> |
| 19 | + <h2 className="text-3xl font-bold font-nulshock tracking-wide text-[#c5bba7]">PROFILE</h2> |
| 20 | + </div> |
| 21 | + |
| 22 | + {/* Body */} |
| 23 | + <div className="p-4"> |
| 24 | + {/* Avatar/Icon */} |
| 25 | + <div className="flex justify-center mt-2 mb-4"> |
| 26 | + <Image |
| 27 | + src="/profile_picture.svg" |
| 28 | + alt="close" |
| 29 | + width={90} |
| 30 | + height={90} |
| 31 | + draggable={false} |
| 32 | + unselectable="on" |
| 33 | + priority |
| 34 | + /> |
| 35 | + </div> |
| 36 | + |
| 37 | + {/* Info */} |
| 38 | + <div className="mt-4 mb-2"> |
| 39 | + <p className="justify-start text-sm font-normal font-inter text-[#c5bba7]">Name</p> |
| 40 | + <p className="justify-start text-white text-lg font-normal font-inter">{name}</p> |
| 41 | + </div> |
| 42 | + |
| 43 | + <div className="mt-2 mb-4"> |
| 44 | + <p className="justify-start text-sm font-normal font-inter text-[#c5bba7]">Email</p> |
| 45 | + <p className="justify-start text-white text-lg font-normal font-inter truncate">{email}</p> |
| 46 | + </div> |
| 47 | + |
| 48 | + {/* Score */} |
| 49 | + <div className="mt-12 mb-4"> |
| 50 | + <p className="text-xl text-[#c5bba7] text-center font-brunoace mb-1"> |
| 51 | + Total Score |
| 52 | + </p> |
| 53 | + |
| 54 | + {/* Progress container */} |
| 55 | + <div className="mt-2 w-full bg-zinc-300 rounded-full h-5 relative overflow-hidden"> |
| 56 | + {/* Green progress bar */} |
| 57 | + <div |
| 58 | + className="bg-green-500 h-5 absolute top-0 left-0" |
| 59 | + style={{ width: `${progress}%` }} |
| 60 | + ></div> |
| 61 | + |
| 62 | + {/* Score text (overlaid, centered across full bar) */} |
| 63 | + <div className="absolute inset-0 flex items-center justify-center"> |
| 64 | + <span className="text-neutral-900 text-lg font-bold font-inter"> |
| 65 | + {totalScore}/{maxScore} |
| 66 | + </span> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | +</div> |
| 70 | + |
| 71 | + |
| 72 | + {/* Log Out Button */} |
| 73 | + <div className="flex justify-center mt-16 mb-8"> |
| 74 | + <button |
| 75 | + onClick={() => { |
| 76 | + // TODO: add logout path here |
| 77 | + }} |
| 78 | + className="!border-2 !border-red-500 !text-[#c5bba7] font-nulshock !bg-neutral-900 !px-2 !py-2 text-sm rounded-md !hover:bg-red-500 hover:text-white transition flex items-center gap-1"> |
| 79 | + <Image |
| 80 | + src="/logout.svg" |
| 81 | + alt="close" |
| 82 | + width={18} |
| 83 | + height={18} |
| 84 | + draggable={false} |
| 85 | + unselectable="on" |
| 86 | + priority |
| 87 | + /> |
| 88 | + LOG OUT |
| 89 | + </button> |
| 90 | + </div> |
| 91 | + </div> |
| 92 | + </div> |
| 93 | + ); |
| 94 | +}; |
| 95 | + |
| 96 | +export default ProfileCard; |
0 commit comments