Separated the ProfileLevel into multiple components and made a Card one

This commit is contained in:
Tiago Ribeiro
2023-03-09 15:56:51 +00:00
parent aa869dd2ce
commit be7665fab8
9 changed files with 124 additions and 33 deletions

View File

@@ -0,0 +1,25 @@
import {levelCalculator} from "@/resources/level";
import clsx from "clsx";
interface Props {
experience: number;
className?: string;
progressBarWidth?: string;
}
export default function LevelProgressBar({experience, className, progressBarWidth = "w-64"}: Props) {
const levelResult = levelCalculator(experience);
return (
<div className={clsx("flex flex-col items-center", className)}>
<div className="flex gap-3 items-center">
<span>Lvl. {levelResult.currentLevel}</span>
<progress className={clsx("progress progress-success", progressBarWidth)} value={levelResult.percentage} max="100" />
<span>Lvl. {levelResult.nextLevel}</span>
</div>
<span className="text-xs">
{experience.toLocaleString("en")} / {levelResult.nextLevelExperience.toLocaleString("en")}
</span>
</div>
);
}