mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-19 00:22:14 +03:00
1d7bc8a5bc
* remove duplicate import * 🚧 add new linter configuration * 🧑💻 add and run prettier * 🐛 add babel parser for linter * 🧑💻 add lint-fix command * 🚨 use lint-fix * 🚨 remove 'FC' as a type. Use const and JSX.Element * 🚨 enforce arrow function rule from linter * 🔥 delete unused file * 🚨 adding /* eslint-disable */ in failing files * 💩 add ts-expect-error to Victory components
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { GiBrain } from "react-icons/gi";
|
|
|
|
import { UserStats } from "../../../lib/types/User";
|
|
|
|
export const BrainConsumption = (userStats: UserStats): JSX.Element => {
|
|
const { current_brain_size, max_brain_size } = userStats;
|
|
const brainFilling = current_brain_size / max_brain_size;
|
|
|
|
const backgroundIcon = (
|
|
<GiBrain
|
|
style={{
|
|
position: "absolute",
|
|
width: "100%",
|
|
height: "100%",
|
|
}}
|
|
className="fill-green-200 stroke-black stroke-1"
|
|
/>
|
|
);
|
|
|
|
const fillingIcon = (
|
|
<GiBrain
|
|
style={{
|
|
position: "absolute",
|
|
width: "100%",
|
|
height: "100%",
|
|
clipPath: `inset(${(1 - brainFilling) * 100}% 0 0 0)`,
|
|
}}
|
|
className="fill-pink-300 stroke-black stoke-1"
|
|
/>
|
|
);
|
|
|
|
return (
|
|
<div className="flex flex-col items-center justify-center w-fit">
|
|
<div className="w-24 h-24 relative">
|
|
{backgroundIcon}
|
|
{fillingIcon}
|
|
</div>
|
|
<div className="flex flex-col items-center justify-center">
|
|
<span className="font-semibold">
|
|
{/* Percentage of brain space left */}
|
|
{(100 - brainFilling * 100).toFixed(2)}%{" "}
|
|
</span>
|
|
<span className="text-sm opacity-50">Empty</span>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|