32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
/* eslint-disable @next/next/no-img-element */
|
|
import {User} from "@/interfaces/user";
|
|
import clsx from "clsx";
|
|
import LevelLabel from "./LevelLabel";
|
|
import LevelProgressBar from "./LevelProgressBar";
|
|
import {Avatar} from "primereact/avatar";
|
|
|
|
interface Props {
|
|
user: User;
|
|
className: string;
|
|
}
|
|
|
|
export default function ProfileCard({user, className}: Props) {
|
|
return (
|
|
<div className={clsx("bg-white drop-shadow-xl p-4 md:p-8 rounded-xl w-full flex flex-col gap-6", className)}>
|
|
<div className="flex w-full items-center gap-8">
|
|
<div className="w-16 md:w-24 h-16 md:h-24 rounded-full border-2 md:border-4 border-white drop-shadow-md md:drop-shadow-xl">
|
|
{user.profilePicture.length > 0 && <img src={user.profilePicture} alt="Profile picture" className="rounded-full object-cover" />}
|
|
{user.profilePicture.length === 0 && (
|
|
<Avatar size="xlarge" style={{width: "100%", height: "100%"}} label={user.name.slice(0, 1)} shape="circle" />
|
|
)}
|
|
</div>
|
|
<div className="flex flex-col justify-center">
|
|
<span className="text-neutral-600 font-bold text-xl lg:text-2xl">{user.name}</span>
|
|
<LevelLabel experience={user.experience} />
|
|
</div>
|
|
</div>
|
|
<LevelProgressBar experience={user.experience} progressBarWidth="w-32 md:w-96" />
|
|
</div>
|
|
);
|
|
}
|