Files
bedolaga-cabinet/src/components/dashboard/StatsGrid.tsx
c0mrade 1a3236f650 fix(cabinet): equal-height StatCards so dashboard balance/referral align
In a grid, the wrapping <Link> stretched to the row height but the
StatCard inside only took content height, so the referral card (which has
a subValue line) rendered taller than the balance card ('один толще
другого'). Make StatCard fill its cell with h-full and stretch the
StatsGrid links. Verified by rendering both cards against the built CSS:
balance 86px->94px, now equal to referral's 94px.
2026-06-06 21:44:07 +03:00

50 lines
1.5 KiB
TypeScript

import { useTranslation } from 'react-i18next';
import { Link } from 'react-router';
import { useCurrency } from '../../hooks/useCurrency';
import { StatCard } from '@/components/stats';
import { CardIcon, ChevronRightIcon, UsersIcon } from '@/components/icons';
interface StatsGridProps {
balanceRubles: number;
referralCount: number;
earningsRubles: number;
refLoading: boolean;
}
export default function StatsGrid({
balanceRubles,
referralCount,
earningsRubles,
refLoading,
}: StatsGridProps) {
const { t } = useTranslation();
const { formatAmount, currencySymbol } = useCurrency();
const chevron = <ChevronRightIcon className="h-4 w-4 shrink-0 text-dark-500" />;
return (
<div className="grid grid-cols-2 gap-2.5">
<Link to="/balance" className="block h-full" data-onboarding="balance">
<StatCard
label={t('dashboard.stats.balance')}
value={`${formatAmount(balanceRubles)} ${currencySymbol}`}
icon={<CardIcon className="h-5 w-5" />}
tone="accent"
trailing={chevron}
/>
</Link>
<Link to="/referral" className="block h-full">
<StatCard
label={t('dashboard.stats.referrals')}
value={`${referralCount}`}
subValue={`+${formatAmount(earningsRubles)} ${currencySymbol}`}
icon={<UsersIcon className="h-5 w-5" />}
tone="neutral"
loading={refLoading}
trailing={chevron}
/>
</Link>
</div>
);
}