Enhance budget input display
- Display existing values in budget input fields. - Remove recessed boxes from category inputs. - Add icons to 식비, 생활비, and 교통비 categories.
This commit is contained in:
@@ -67,6 +67,21 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
|
|||||||
setShowBudgetInput(false);
|
setShowBudgetInput(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 기존 카테고리 예산 불러오기
|
||||||
|
useEffect(() => {
|
||||||
|
if (showBudgetInput) {
|
||||||
|
// 로컬 스토리지에서 카테고리 예산 불러오기
|
||||||
|
try {
|
||||||
|
const storedCategoryBudgets = localStorage.getItem('categoryBudgets');
|
||||||
|
if (storedCategoryBudgets) {
|
||||||
|
setCategoryBudgets(JSON.parse(storedCategoryBudgets));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('카테고리 예산 불러오기 오류:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [showBudgetInput]);
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
{targetAmount > 0 ? <>
|
{targetAmount > 0 ? <>
|
||||||
<div className="flex justify-between items-center mb-3">
|
<div className="flex justify-between items-center mb-3">
|
||||||
@@ -92,12 +107,12 @@ const BudgetTabContent: React.FC<BudgetTabContentProps> = ({
|
|||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
<button
|
<button
|
||||||
onClick={() => setShowBudgetInput(true)}
|
onClick={() => setShowBudgetInput(true)}
|
||||||
className="text-neuro-income hover:underline flex items-center text-base font-bold group"
|
className="text-neuro-income hover:underline flex items-center text-lg font-bold group"
|
||||||
>
|
>
|
||||||
<div className="mr-2 bg-neuro-income text-white rounded-full p-1 transition-transform group-hover:scale-110">
|
<div className="mr-2 bg-neuro-income text-white rounded-full p-1 transition-transform group-hover:scale-110">
|
||||||
<CirclePlus size={20} className="animate-pulse" />
|
<CirclePlus size={20} className="animate-pulse" />
|
||||||
</div>
|
</div>
|
||||||
<span className="text-lg">예산 수정하기</span>
|
<span>예산 수정하기</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</> : <div className="py-4 text-center">
|
</> : <div className="py-4 text-center">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { EXPENSE_CATEGORIES } from '@/constants/categoryIcons';
|
import { EXPENSE_CATEGORIES, categoryIcons } from '@/constants/categoryIcons';
|
||||||
import { useIsMobile } from '@/hooks/use-mobile';
|
import { useIsMobile } from '@/hooks/use-mobile';
|
||||||
|
|
||||||
interface CategoryBudgetInputsProps {
|
interface CategoryBudgetInputsProps {
|
||||||
@@ -37,13 +37,16 @@ const CategoryBudgetInputs: React.FC<CategoryBudgetInputsProps> = ({
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-3 w-full">
|
<div className="space-y-3 w-full">
|
||||||
{EXPENSE_CATEGORIES.map(category => (
|
{EXPENSE_CATEGORIES.map(category => (
|
||||||
<div key={category} className="flex items-center justify-between w-full p-2 neuro-pressed rounded-lg">
|
<div key={category} className="flex items-center justify-between w-full p-2 rounded-lg">
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<span className="text-neuro-income">{categoryIcons[category]}</span>
|
||||||
<label className="text-sm font-medium text-gray-700">{category}</label>
|
<label className="text-sm font-medium text-gray-700">{category}</label>
|
||||||
|
</div>
|
||||||
<Input
|
<Input
|
||||||
value={formatWithCommas(categoryBudgets[category] || 0)}
|
value={formatWithCommas(categoryBudgets[category] || 0)}
|
||||||
onChange={(e) => handleInput(e, category)}
|
onChange={(e) => handleInput(e, category)}
|
||||||
placeholder="예산 입력"
|
placeholder="예산 입력"
|
||||||
className={`neuro-pressed transition-colors duration-300 ${isMobile ? 'w-[150px]' : 'max-w-[150px]'}`}
|
className={`transition-colors duration-300 ${isMobile ? 'w-[150px]' : 'max-w-[150px]'}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user