From de128ac57a354063b5e3d0d3c09cdf34be1a4d9d Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 12:26:02 +0000 Subject: [PATCH] Improve title suggestion display - Fix issue where title suggestions were not hidden correctly. - Add animation to collapsible content for a smoother user experience. --- src/components/expenses/ExpenseForm.tsx | 127 +++++++++-------- .../transaction/TransactionFormFields.tsx | 131 ++++++++++-------- 2 files changed, 146 insertions(+), 112 deletions(-) diff --git a/src/components/expenses/ExpenseForm.tsx b/src/components/expenses/ExpenseForm.tsx index 8d92ee3..87f5955 100644 --- a/src/components/expenses/ExpenseForm.tsx +++ b/src/components/expenses/ExpenseForm.tsx @@ -49,7 +49,12 @@ const ExpenseForm: React.FC = ({ onSubmit, onCancel, isSubmitt if (selectedCategory) { const suggestions = getPersonalizedTitleSuggestions(selectedCategory); setTitleSuggestions(suggestions); - setShowTitleSuggestions(true); + // 약간의 지연 후 제목 추천 표시 (애니메이션을 위해) + setTimeout(() => { + setShowTitleSuggestions(true); + }, 100); + } else { + setShowTitleSuggestions(false); } }, [selectedCategory]); @@ -88,21 +93,29 @@ const ExpenseForm: React.FC = ({ onSubmit, onCancel, isSubmitt )} /> - {/* 카테고리별 제목 제안 - 카테고리 선택 후에만 표시 */} - {showTitleSuggestions && titleSuggestions.length > 0 && ( -
-
- {titleSuggestions.map((suggestion) => ( - handleTitleSuggestionClick(suggestion)} - > - {suggestion} - - ))} -
+ {/* 카테고리별 제목 제안 - 카테고리 선택 후에만 표시, 서랍처럼 열리는 애니메이션 적용 */} + {selectedCategory && ( +
+ {titleSuggestions.length > 0 && ( +
+ {titleSuggestions.map((suggestion) => ( + handleTitleSuggestionClick(suggestion)} + > + {suggestion} + + ))} +
+ )}
)} @@ -140,46 +153,50 @@ const ExpenseForm: React.FC = ({ onSubmit, onCancel, isSubmitt )} /> - {/* 지출 방법 필드는 금액 입력 시에만 표시 */} - {showPaymentMethod && ( - <> - - - ( - - 지출 방법 -
-
!isSubmitting && form.setValue('paymentMethod', '신용카드')} - > - - 신용카드 -
-
!isSubmitting && form.setValue('paymentMethod', '현금')} - > - - 현금 -
+ {/* 지출 방법 필드는 금액 입력 시에만 표시 - 서랍처럼 열리는 애니메이션 적용 */} +
+ + + ( + + 지출 방법 +
+
!isSubmitting && form.setValue('paymentMethod', '신용카드')} + > + + 신용카드
- - )} - /> - - )} +
!isSubmitting && form.setValue('paymentMethod', '현금')} + > + + 현금 +
+
+
+ )} + /> +