Skip to content

Commit 317ef99

Browse files
authored
Merge pull request #100 from code-zero-to-one/QNRR-396-유수아-프로필-수정-모달-placeholder-변경
Qnrr 396 프로필 수정 모달 placeholder 변경
2 parents f4c3723 + fb5bde7 commit 317ef99

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/features/my-page/ui/profile-edit-modal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ function ProfileEditForm({
8181
// 이름 유효성 검사: 2~10자, 한글 또는 영문만 허용
8282
const isNameValid = /^[-a-zA-Z]{2,10}$/.test(profileForm.name);
8383
// 연락처 유효성 검사: "(2~3자리 지역번호)-(3~4자리 번호)-(4자리 번호)" 형식
84-
const isTelValid =
85-
profileForm.tel.length === 0 ||
86-
/^\d{2,3}-\d{3,4}-\d{4}$/.test(profileForm.tel);
84+
const isTelValid = /^\d{2,3}-\d{3,4}-\d{4}$/.test(profileForm.tel);
8785

8886
const queryClient = useQueryClient();
8987
const { mutateAsync: updateProfile } = useUpdateUserProfileMutation(memberId);
@@ -191,12 +189,13 @@ function ProfileEditForm({
191189
<FormField
192190
label="연락처"
193191
type="text"
194-
error={!isTelValid}
192+
error={!(isTelValid || profileForm.tel === '')}
195193
description={
196-
isTelValid
194+
isTelValid || profileForm.tel === ''
197195
? '스터디 진행을 위한 연락 가능한 정보를 입력해 주세요.'
198196
: '연락처는 숫자와 하이픈(-)을 포함한 형식으로 입력해주세요.'
199197
}
198+
placeholder="010-1234-5678"
200199
value={profileForm.tel}
201200
onChange={(value) => {
202201
// 숫자와 하이픈(-)만 입력 허용
@@ -209,6 +208,7 @@ function ProfileEditForm({
209208
label="Github"
210209
type="text"
211210
description="본인의 활동을 확인할 수 있는 GitHub 링크를 입력해 주세요."
211+
placeholder="https://github.com/username"
212212
value={profileForm.githubLink}
213213
onChange={(value) =>
214214
setProfileForm({

src/shared/ui/form/form-field.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type InputType =
1414
interface FormFieldProps<T> {
1515
label: string;
1616
description?: string;
17+
placeholder?: string;
1718
type: InputType;
1819
maxLength?: number;
1920
required?: boolean;
@@ -28,6 +29,7 @@ export function FormField<T>({
2829
label,
2930
error = false,
3031
description,
32+
placeholder,
3133
type,
3234
required = false,
3335
maxLength = 30,
@@ -42,7 +44,7 @@ export function FormField<T>({
4244
return (
4345
<>
4446
<BaseInput
45-
placeholder="입력하세요."
47+
placeholder={placeholder || '입력해주세요.'}
4648
value={value as string}
4749
color={error ? 'error' : 'default'}
4850
onChange={(e) => onChange(e.target.value as T)}
@@ -59,7 +61,7 @@ export function FormField<T>({
5961
case 'textarea':
6062
return (
6163
<TextAreaInput
62-
placeholder="입력하세요."
64+
placeholder={placeholder || '입력해주세요.'}
6365
guideText={description}
6466
value={value as string}
6567
maxLength={maxLength}
@@ -72,7 +74,7 @@ export function FormField<T>({
7274
<SingleDropdown
7375
options={options}
7476
defaultValue={value ? (value as string) : undefined}
75-
placeholder="선택해주세요"
77+
placeholder={placeholder || '선택해주세요'}
7678
onChange={(v) => onChange(v as T)}
7779
/>
7880
{description && (
@@ -89,7 +91,7 @@ export function FormField<T>({
8991
options={options}
9092
defaultValue={value as string[]}
9193
onChange={(v) => onChange(v as T)}
92-
placeholder="선택해주세요"
94+
placeholder={placeholder || '선택해주세요.'}
9395
/>
9496
{description && (
9597
<div className="font-designer-13r text-text-subtlest">

0 commit comments

Comments
 (0)