Fix: Match chart colors to category list
Updated the expense chart to use the same colors as the category spending list for 음식, 쇼핑, and 교통비.
This commit is contained in:
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import { formatCurrency } from '@/utils/formatters';
|
||||
import { useIsMobile } from '@/hooks/use-mobile';
|
||||
import { CATEGORY_DESCRIPTIONS } from '@/constants/categoryIcons';
|
||||
import { getCategoryColor } from '@/utils/categoryColorUtils';
|
||||
|
||||
interface CategorySpending {
|
||||
title: string;
|
||||
@@ -23,19 +24,6 @@ const CategorySpendingList: React.FC<CategorySpendingListProps> = ({
|
||||
}) => {
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
// 카테고리별 색상 매핑
|
||||
const getCategoryColor = (title: string) => {
|
||||
// 카테고리 이름에 따라 적절한 색상 반환
|
||||
switch (title) {
|
||||
case '음식': return '#81c784';
|
||||
case '쇼핑': return '#AED581';
|
||||
case '교통비': return '#2E7D32';
|
||||
case '식비': return '#81c784'; // 이전 이름과의 호환성 유지
|
||||
case '생활비': return '#AED581'; // 이전 이름과의 호환성 유지
|
||||
default: return '#4CAF50';
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`neuro-card mb-6 w-full ${className}`}>
|
||||
{categories.some(cat => cat.current > 0) ? (
|
||||
@@ -50,7 +38,7 @@ const CategorySpendingList: React.FC<CategorySpendingListProps> = ({
|
||||
<div key={categoryName} className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-6 h-6 rounded-full" style={{
|
||||
backgroundColor: getCategoryColor(categoryName)
|
||||
backgroundColor: getCategoryColor(categoryName) // 일관된 색상 적용
|
||||
}}></div>
|
||||
<span>
|
||||
{categoryName}
|
||||
|
||||
Reference in New Issue
Block a user