Skip to content

Commit 707f2b4

Browse files
committed
[KB] feat[#267]: 회원가입 페이지에 비밀번호 가리기
1 parent b19e288 commit 707f2b4

File tree

2 files changed

+88
-2
lines changed

2 files changed

+88
-2
lines changed

src/components/Auth/Register/RegisterForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import WidthSpacer from '~/components/Common/WidthSpacer';
1010
import AlertModal from '~/components/Modal/Alert/AlertModal';
1111
import { ReqSignUp } from '~/models/Auth';
1212
import RegisterInputTextField from './RegisterInputTextField';
13+
import RegisterPasswordTextField from './RegisterPasswordTextField';
1314
import { useRegisterStore } from '~/store/registerStore';
1415
import axios from 'axios';
1516

@@ -473,7 +474,7 @@ function RegisterForm() {
473474
valid={!inputErrors['username']}
474475
errorMessage={errorMessages['username']}
475476
/>
476-
<RegisterInputTextField
477+
<RegisterPasswordTextField
477478
name="password"
478479
value={formData.password}
479480
label="비밀번호"
@@ -483,7 +484,7 @@ function RegisterForm() {
483484
valid={!inputErrors['password']}
484485
errorMessage={errorMessages['password']}
485486
/>
486-
<RegisterInputTextField
487+
<RegisterPasswordTextField
487488
name="passwordCheck"
488489
value={formData.passwordCheck}
489490
label="비밀번호 확인"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
4+
const Input = styled.div`
5+
display: flex;
6+
flex-direction: column;
7+
width: 100%;
8+
margin-bottom: 2rem;
9+
10+
label {
11+
color: var(--color-dark);
12+
font-family: 'Pretendard SemiBold';
13+
font-size: 1.25rem;
14+
margin-bottom: 0.75rem;
15+
user-select: none;
16+
}
17+
18+
input {
19+
background-color: var(--color-white);
20+
color: var(--color-dark-text);
21+
font-size: 1.25rem;
22+
border: 1px solid var(--color-dark-stroke);
23+
border-radius: 0.5rem;
24+
padding: 1.5rem 1rem;
25+
box-sizing: border-box;
26+
height: 66px;
27+
flex: 1;
28+
29+
@media (max-width: 480px) {
30+
padding: 1.2rem 0.8rem;
31+
}
32+
}
33+
34+
input:read-only {
35+
background-color: var(--color-background);
36+
}
37+
38+
input.error {
39+
border-color: red;
40+
}
41+
42+
div.error {
43+
margin-top: 0.25rem;
44+
margin-left: 0.25rem;
45+
color: red;
46+
font-size: 1rem;
47+
}
48+
`;
49+
50+
export default function RegisterPasswordTextField({
51+
name,
52+
value,
53+
label,
54+
placeHolder,
55+
onChange,
56+
onBlur,
57+
valid,
58+
errorMessage,
59+
}: {
60+
name: string;
61+
value: string;
62+
label: string;
63+
placeHolder: string;
64+
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
65+
onBlur: (_e: React.FocusEvent<HTMLInputElement>) => void;
66+
valid: boolean;
67+
errorMessage: string;
68+
}) {
69+
return (
70+
<Input>
71+
<label htmlFor={name}>{label}</label>
72+
<input
73+
type="password"
74+
name={name}
75+
id={name}
76+
placeholder={placeHolder}
77+
value={value}
78+
onChange={onChange}
79+
onBlur={onBlur}
80+
className={!valid ? 'error' : ''}
81+
/>
82+
{!valid && <div className="error">{errorMessage}</div>}
83+
</Input>
84+
);
85+
}

0 commit comments

Comments
 (0)