diff --git a/src/components/BudgetCategoriesSection.tsx b/src/components/BudgetCategoriesSection.tsx index bf9e872..834380b 100644 --- a/src/components/BudgetCategoriesSection.tsx +++ b/src/components/BudgetCategoriesSection.tsx @@ -17,34 +17,43 @@ const BudgetCategoriesSection: React.FC = ({ return <>

지출 그래프

- {categories.map((category, index) => ( -
-
-
- {categoryIcons[category.title]} + {categories.map((category, index) => { + // 남은 예산 계산 (음수가 되지 않도록) + const remaining = Math.max(0, category.total - category.current); + const percentage = Math.min(Math.round((category.current / category.total) * 100), 100); + + return ( +
+
+
+ {categoryIcons[category.title]} +
+

{category.title}

+
+ +
+

{formatCurrency(category.current)}

+

/ {formatCurrency(category.total)}

+
+ +
+
+
+ +
+ + 남은 예산: {formatCurrency(remaining)} + + + {percentage}% +
-

{category.title}

- -
-

{formatCurrency(category.current)}

-

/ {formatCurrency(category.total)}

-
- -
-
-
- -
- - {Math.min(Math.round((category.current / category.total) * 100), 100)}% - -
-
- ))} + ); + })}
; };