Files
assetx/components/StatsCards.tsx
default 9e0dd1d278 feat: integrate HeroUI component library
Implemented HeroUI migration plan with the following changes:

Stage 0: Environment Setup
- Installed @heroui/react@2.8.7, @heroui/theme@2.4.26, framer-motion@12.29.2
- Configured Tailwind with HeroUI plugin
- Added HeroUI content paths to Tailwind config

Stage 1: Provider Architecture
- Created Providers.tsx wrapper combining HeroUIProvider and AppProvider
- Updated app/layout.tsx to use new Providers component
- Preserved all AppContext functionality (theme, language, translations)

Stage 2: Component Migrations
- TabNavigation: Migrated to HeroUI Tabs with keyboard navigation support
- TopBar: Migrated buttons to HeroUI Button components
- LanguageSwitch: Migrated to HeroUI Dropdown for better UX
- ThemeSwitch: Migrated to HeroUI Button (isIconOnly variant)
- MintSwapPanel: Migrated to HeroUI Tabs and Button components

Benefits:
- Enhanced accessibility with ARIA attributes and keyboard navigation
- Smooth animations and transitions via Framer Motion
- Consistent component API across the application
- Maintained all existing design tokens and color system
- Preserved dark mode functionality

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-30 03:49:53 +00:00

62 lines
1.9 KiB
TypeScript

"use client";
import { useApp } from "@/contexts/AppContext";
interface StatCardProps {
label: string;
value: string;
change?: string;
changeColor?: string;
valueColor?: string;
}
function StatCard({
label,
value,
change,
changeColor = "text-green-500",
valueColor
}: StatCardProps) {
const getValueColor = () => {
if (valueColor) return valueColor;
if (label.includes("APY") || label.includes("年化")) return "#ff6900";
return "#111827";
};
return (
<div className="bg-bg-subtle dark:bg-gray-700 rounded-2xl border border-border-gray dark:border-gray-600 p-4 flex flex-col gap-2">
<p className="text-caption-tiny font-bold text-text-tertiary dark:text-gray-400 uppercase tracking-wider">
{label}
</p>
<p className="text-heading-h3 font-bold dark:text-white" style={{ color: getValueColor() }}>
{value}
</p>
{change && (
<p className={`text-caption-tiny font-medium ${changeColor} dark:text-gray-400`}>
{change}
</p>
)}
</div>
);
}
export default function StatsCards() {
const { t } = useApp();
return (
<div className="grid grid-cols-5 gap-4 w-full">
<StatCard label={t("stats.currentAPY")} value="22%" change="+2.5% WoW" changeColor="text-green-500" />
<StatCard label={t("stats.totalValueLocked")} value="$240.5M" change="+$2.3M Today" changeColor="text-green-500" />
<StatCard label="24h Volume" value="$12.8M" change="↑ 23% vs Avg" changeColor="text-green-500" />
<StatCard label={t("stats.yourBalance")} value="0.00" change="$0.00 USD" changeColor="text-text-tertiary" />
<StatCard
label={t("stats.yourEarnings")}
value="$0.00"
change="All Time"
changeColor="text-text-tertiary"
valueColor="#10b981"
/>
</div>
);
}