Skip to content

Commit

Permalink
Feat: 비밀번호 보이기 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hahahaday12 committed Nov 5, 2023
1 parent 7261a78 commit c3cc5d0
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/components/Form/JoinForm/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const Joininput = () => {
const [passwordMessage, setPasswordMessage] = useState('');
const [passwordConfirmMessage, setPasswordConfirmMessage] = useState('');

const [passwordVisible, setPasswordVisible] = useState(false);
const [confirmPasswordVisible, setConfirmPasswordVisible] = useState(false);

const navigateToHome = () => navigate('/');

const handleEnter = (e) => {
Expand Down Expand Up @@ -118,6 +121,14 @@ const Joininput = () => {
}
}, []);

const togglePasswordVisibility = () => {
setPasswordVisible(!passwordVisible);
};

const toggleConfirmPasswordVisibility = () => {
setConfirmPasswordVisible(!confirmPasswordVisible);
};

//passwordConfirm 의 값이 변경될 때 호출
const onRepassword = useCallback(
(e) => {
Expand Down Expand Up @@ -161,7 +172,7 @@ const Joininput = () => {
</Formbox>
<Formbox>
<input
type="password"
type={passwordVisible ? 'text' : 'password'}
placeholder="비밀번호를 입력하세요"
autoComplete="off"
name="password"
Expand All @@ -172,10 +183,13 @@ const Joininput = () => {
{passwordMessage}
</span>
)}
<span className="password-toggle" onClick={togglePasswordVisibility}>
{passwordVisible ? '숨기기' : '보이기'}
</span>
</Formbox>
<Formbox>
<input
type="password"
type={confirmPasswordVisible ? 'text' : 'password'}
placeholder="비밀번호를 한번 더 입력해주세요"
autoComplete="off"
name="passwordConfirm"
Expand All @@ -189,6 +203,12 @@ const Joininput = () => {
{passwordConfirmMessage}
</span>
)}
<span
className="password-toggle"
onClick={toggleConfirmPasswordVisibility}
>
{confirmPasswordVisible ? '숨기기' : '보이기'}
</span>
</Formbox>
<section>
<RegisterButton
Expand Down Expand Up @@ -260,6 +280,7 @@ const Formbox = styled.div`
}
}
`;

const Linkbox = styled.div`
left: 250px;
width: 120px;
Expand All @@ -273,6 +294,7 @@ const Linkbox = styled.div`
text-decoration: none;
}
`;

const ButtonText = styled.div`
font-size: ${fontsize[2]};
color: white;
Expand Down

0 comments on commit c3cc5d0

Please sign in to comment.