mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
fix: reserve fixed-width chevron slot so category amounts stay aligned
Стрелка-шеврон появлялась только у строк с дочерними категориями, из-за чего сумма в такой строке сдвигалась влево относительно остальных. Теперь под стрелку всегда резервируется одинаковое место (пустое, если разбивки нет), и суммы во всех строках выравниваются по одному краю.
This commit is contained in:
@@ -89,16 +89,21 @@ export function SpendingByCategoryCard({ items }: SpendingByCategoryCardProps) {
|
||||
<span className="shrink-0 text-sm font-medium tabular-nums text-text-primary">
|
||||
{formatCurrency(item.amount)}
|
||||
</span>
|
||||
{hasChildren && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t("common.expand")}
|
||||
onClick={() => setBreakdownItem(item)}
|
||||
className="shrink-0 rounded-md p-1 text-text-muted hover:bg-surface-2 hover:text-text-primary"
|
||||
>
|
||||
<ChevronRight size={15} />
|
||||
</button>
|
||||
)}
|
||||
{/* Fixed-width slot on every row, populated or not — a
|
||||
chevron shown only on rows with children would shift
|
||||
their amount left relative to every other row's. */}
|
||||
<span className="flex h-6 w-5 shrink-0 items-center justify-center">
|
||||
{hasChildren && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t("common.expand")}
|
||||
onClick={() => setBreakdownItem(item)}
|
||||
className="rounded-md p-0.5 text-text-muted hover:bg-surface-2 hover:text-text-primary"
|
||||
>
|
||||
<ChevronRight size={15} />
|
||||
</button>
|
||||
)}
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -80,16 +80,21 @@ export function CategoryRankingCard({ items, isLoading, selectedCategoryId, onSe
|
||||
{formatCurrency(item.amount)}
|
||||
</span>
|
||||
</button>
|
||||
{hasChildren && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t("common.expand")}
|
||||
onClick={() => setBreakdownItem(item)}
|
||||
className="mr-1 shrink-0 rounded-md p-1.5 text-text-muted hover:text-text-primary"
|
||||
>
|
||||
<ChevronRight size={14} />
|
||||
</button>
|
||||
)}
|
||||
{/* Fixed-width slot on every row, populated or not — a
|
||||
chevron shown only on rows with children would shift
|
||||
their amount left relative to every other row's. */}
|
||||
<span className="mr-1 flex h-8 w-7 shrink-0 items-center justify-center">
|
||||
{hasChildren && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t("common.expand")}
|
||||
onClick={() => setBreakdownItem(item)}
|
||||
className="rounded-md p-1.5 text-text-muted hover:text-text-primary"
|
||||
>
|
||||
<ChevronRight size={14} />
|
||||
</button>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user