+
@@ -139,14 +185,28 @@ export default function FindIdPage() {
name="phone"
type="tel"
inputMode="numeric"
- value={phone}
- onChange={(e) => setPhone(e.target.value.replace(/[^0-9]/g, ""))}
+ value={formatPhoneNumber(phone)}
+ onChange={(e) => {
+ const numbersOnly = e.target.value.replace(/[^0-9]/g, "");
+ setPhone(numbersOnly);
+ if (errors.phone) {
+ setErrors((prev) => {
+ const next = { ...prev };
+ delete next.phone;
+ return next;
+ });
+ }
+ }}
onFocus={() => setFocused((p) => ({ ...p, phone: true }))}
onBlur={() => setFocused((p) => ({ ...p, phone: false }))}
placeholder="-없이 입력해 주세요."
- className="h-[40px] px-[12px] py-[7px] w-full rounded-[8px] border mt-3 border-neutral-40 focus:outline-none focus:border-neutral-700 text-[18px] text-neutral-700 placeholder:text-input-placeholder-text pr-[40px]"
+ className={`h-[40px] px-[12px] py-[7px] w-full rounded-[8px] border mt-3 focus:outline-none text-[18px] text-neutral-700 placeholder:text-input-placeholder-text pr-[40px] ${
+ errors.phone
+ ? "border-error focus:border-error"
+ : "border-neutral-40 focus:border-neutral-700"
+ }`}
/>
- {phone.trim().length > 0 && focused.phone && (
+ {phone.length > 0 && focused.phone && (
)}
@@ -164,12 +224,13 @@ export default function FindIdPage() {
+