fix:수동거래 금액 input focus 시 0 제거, blur 시 복원 (placeholder 패턴)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1024,6 +1024,7 @@ className="flex-1 py-2 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700
|
||||
const [form, setForm] = useState({});
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [baseBalance, setBaseBalance] = useState(0);
|
||||
const [focusedField, setFocusedField] = useState(null);
|
||||
|
||||
const isEditMode = !!editData;
|
||||
|
||||
@@ -1300,9 +1301,11 @@ className="text-red-600"
|
||||
<label className="block text-sm font-medium text-stone-700 mb-1">금액 <span className="text-red-500">*</span></label>
|
||||
<input
|
||||
type="text"
|
||||
value={formatAmount(form.amount)}
|
||||
value={focusedField === 'amount' && form.amount === 0 ? '' : formatAmount(form.amount)}
|
||||
onChange={(e) => handleAmountChange('amount', e.target.value)}
|
||||
placeholder="0"
|
||||
onFocus={() => setFocusedField('amount')}
|
||||
onBlur={() => setFocusedField(null)}
|
||||
placeholder="금액 입력"
|
||||
className="w-full px-3 py-2 border border-stone-200 rounded-lg text-sm focus:ring-2 focus:ring-emerald-500 outline-none text-right"
|
||||
/>
|
||||
</div>
|
||||
@@ -1312,9 +1315,11 @@ className="w-full px-3 py-2 border border-stone-200 rounded-lg text-sm focus:rin
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={formatAmount(form.balance)}
|
||||
value={focusedField === 'balance' && form.balance === 0 ? '' : formatAmount(form.balance)}
|
||||
onChange={(e) => handleAmountChange('balance', e.target.value)}
|
||||
placeholder="0"
|
||||
onFocus={() => setFocusedField('balance')}
|
||||
onBlur={() => setFocusedField(null)}
|
||||
placeholder="잔액"
|
||||
className="w-full px-3 py-2 border border-stone-200 rounded-lg text-sm focus:ring-2 focus:ring-emerald-500 outline-none text-right bg-stone-50"
|
||||
/>
|
||||
{baseBalance !== 0 && (
|
||||
|
||||
Reference in New Issue
Block a user