feat(sidebar): add wallet top up card

This commit is contained in:
2026-06-29 13:22:50 +08:00
parent b03083bacd
commit 274fe87ced
4 changed files with 209 additions and 4 deletions
@@ -0,0 +1,44 @@
"use client";
import { Coins } from "lucide-react";
import styles from "./sidebar-wallet-card.module.css";
export interface SidebarWalletCardProps {
creditBalance: number;
onTopUp: () => void;
}
const formatCoins = (value: number): string =>
new Intl.NumberFormat("en-US").format(Math.max(0, Math.trunc(value)));
export function SidebarWalletCard({
creditBalance,
onTopUp,
}: SidebarWalletCardProps) {
return (
<section className={styles.card} aria-label="My wallet">
<div className={styles.leftColumn}>
<div className={styles.titleRow}>
<span className={styles.iconWrap} aria-hidden="true">
<Coins size={18} strokeWidth={2.4} />
</span>
<h2 className={styles.title}>My Wallet</h2>
</div>
<p className={styles.balance}>
<span className={styles.balanceValue}>{formatCoins(creditBalance)}</span>
<span className={styles.balanceUnit}> coins</span>
</p>
<button type="button" className={styles.rulesButton}>
Coins
</button>
</div>
<button type="button" className={styles.topUpButton} onClick={onTopUp}>
Top Up
</button>
</section>
);
}