Skip to content

Commit

Permalink
dashboard: split balance into its own component
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilou97 committed Mar 26, 2024
1 parent 32958d7 commit 438facc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions components/dashboard/balance.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
type BalanceProperty = {
balance: number;
evolution?: number;
price?: number;
};

const Balance = ({ balance, evolution, price }: BalanceProperty) => {
const isPriceIncreasing = evolution ? evolution >= 1 : false;
return (
<>
<div className="text-xl">Balance</div>
<div
className={`font-light ${
isPriceIncreasing ? "text-emerald-500" : "text-red-500"
}`}
>
{isPriceIncreasing ? "+" : "-"}
{evolution && ((evolution - 1) * 100).toFixed(2)}
</div>
<div className="font-light">{balance.toFixed(2)} XTZ</div>
<div className="font-light">
{price && (balance * price).toFixed(2)} $
</div>
</>
);
};

export default Balance;

0 comments on commit 438facc

Please sign in to comment.