Commit 398e482d authored by 한규민's avatar 한규민
Browse files

signup

parent d998c4b0
...@@ -11,7 +11,9 @@ const Signup = () => { ...@@ -11,7 +11,9 @@ const Signup = () => {
userPassword: '', userPassword: '',
userRePassword: '', userRePassword: '',
}) })
// 비밀번호와 비밀번호 확인 일치여부, 중복확인 창
const [passwordError,setPasswordError] = useState(false); const [passwordError,setPasswordError] = useState(false);
const [overlapId,setOverlapIdError] = useState(false);
const handleUserOnChange = (e) => { const handleUserOnChange = (e) => {
setUserState({ setUserState({
...@@ -22,23 +24,30 @@ const Signup = () => { ...@@ -22,23 +24,30 @@ const Signup = () => {
setPasswordError(e.target.value !== userText.userPassword); setPasswordError(e.target.value !== userText.userPassword);
}} }}
//중복되었으면 중복확인 창 띄우는 여부를 state에 전달
const handleOverlapIdError = (e) => {
e.preventDefault();
setOverlapIdError(true);
}
//가입완료 누르면 콘솔창에 전달하려는 state 보여줌
const onSubmit = (e) => { const onSubmit = (e) => {
e.preventDefault(); e.preventDefault();
if(userText.userPassword !== userText.userRePassword){ console.log(userText)
return setPasswordError(true);
}
console.log(userText);
} }
return ( return (
<form className={`d-flex col-md-6 col-12 justify-content-center`}> <form className={`d-flex col-md-6 col-12 justify-content-center`}>
<div className="d-flex flex-column"> <div className="d-flex flex-column">
<div className={styles.inputContent}> <span className={styles.title}>회원가입</span>
<label className={styles.signupLabel}>아이디</label> <div className="d-flex flex-column">
<div className="d-flex col-md-auto"> <div className={styles.inputContent}>
<input className={styles.input} type="text" name="userID" id="userID" placeholder="8자리입력" onChange={handleUserOnChange} maxLength="8" minlength="8" required /> <label className={styles.signupLabel}>아이디</label>
<button type="button" className={`rounded-2 mt-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} data-bs-toggle="modal" data-bs-target="#exampleModal">중복확인</button> <div className="d-flex col-md-auto">
</div> <input className={styles.input} type="text" name="userID" id="userID" placeholder="8자리입력" onChange={handleUserOnChange} maxLength="8" minlength="8" required />
<button type="button" className={`rounded-2 mt-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} onClick={handleOverlapIdError} data-bs-toggle="modal" data-bs-target="#exampleModal">중복확인</button>
</div>
</div>
{overlapId && <p className={styles.passwordConfirmError}>아이디 중복확인이 되었습니다.</p>}
</div> </div>
<div className={styles.inputContent}> <div className={styles.inputContent}>
<label className={styles.signupLabel}>별명</label> <label className={styles.signupLabel}>별명</label>
...@@ -54,17 +63,17 @@ const Signup = () => { ...@@ -54,17 +63,17 @@ const Signup = () => {
</div> </div>
<div className={`${styles.inputContent}`}> <div className={`${styles.inputContent}`}>
<label className={styles.signupLabel}>비밀번호</label> <label className={styles.signupLabel}>비밀번호</label>
<input className={`${styles.input} ${styles.inputSize}`} type="text" name="userPassword" id="password" placeholder="8자리 입력" onChange={handleUserOnChange} maxLength="8" minlength="8" required /> <input className={`${styles.input} ${styles.inputSize}`} type="password" name="userPassword" id="password" placeholder="8자리 입력" onChange={handleUserOnChange} maxLength="8" minlength="8" required />
</div> </div>
<div className="d-flex flex-column"> <div className="d-flex flex-column">
<div className={styles.inputContent}> <div className={styles.inputContent}>
<label className={styles.signupLabel}>비밀번호 확인</label> <label className={styles.signupLabel}>비밀번호 확인</label>
<input className={`${styles.input} ${styles.inputSize}`} type="text" name="userRePassword" id="userRePassword" placeholder="8자리 입력" onChange={handleUserOnChange} maxLength="8" minlength="8" required /> <input className={`${styles.input} ${styles.inputSize}`} type="password" name="userRePassword" id="userRePassword" placeholder="8자리 입력" onChange={handleUserOnChange} maxLength="8" minlength="8" required />
</div> </div>
{passwordError && <p className={styles.passwordConfirmError}>비밀번호가 일치하지 않습니다.</p>} {passwordError && <p className={styles.passwordConfirmError}>비밀번호가 일치하지 않습니다.</p>}
</div> </div>
<input className={`rounded-1 my-3 py-2 ${styles.butterYellowAndBtn} ${styles.btnHover}`} type="submit" value="가입하기" onClick={onSubmit}/> <buttom type="button" className={`rounded- my-3 py-2 fs-5 ${styles.butterYellowAndBtn} ${styles.btnHover}`} type="submit" onClick={onSubmit} data-bs-toggle="modal" data-bs-target="#exampleModal2">가입하기</buttom>
</div> </div>
{/* 아이디 중복 확인 모달창 */} {/* 아이디 중복 확인 모달창 */}
...@@ -73,7 +82,6 @@ const Signup = () => { ...@@ -73,7 +82,6 @@ const Signup = () => {
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">아이디 중복 확인</h5> <h5 class="modal-title" id="exampleModalLabel">아이디 중복 확인</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
아이디는 사용가능합니다. 아이디는 사용가능합니다.
...@@ -84,6 +92,23 @@ const Signup = () => { ...@@ -84,6 +92,23 @@ const Signup = () => {
</div> </div>
</div> </div>
</div> </div>
{/* 회원가입 완료 모달창 */}
<div class="modal fade" id="exampleModal2" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">회원가입</h5>
</div>
<div class="modal-body">
회원가입이 완료되었습니다.
</div>
<div class="modal-footer">
<button type="button" className="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
</form> </form>
......
.title{
display: flex;
justify-content: center;
color: #FEDC00;
font-size: 25px;
margin-top: 20px;
}
.contents{ .contents{
display: flex; display: flex;
width: 100%; width: 100%;
...@@ -8,6 +16,7 @@ ...@@ -8,6 +16,7 @@
.signupLabel{ .signupLabel{
color: white; color: white;
padding-right: 8px; padding-right: 8px;
text-align: left;
} }
.inputContent{ .inputContent{
...@@ -19,11 +28,19 @@ ...@@ -19,11 +28,19 @@
.input { .input {
margin: 0.5rem 0 0 0; margin: 0.5rem 0 0 0;
padding: 0.5rem 0 0.5rem 0; padding: 0.5rem 0 0.5rem 0;
color:black;
border-radius: 3px; border-radius: 3px;
text-align: center; text-align: center;
} }
input[type=password]{
font-family: 'Courier New', Courier, monospace;
}
input::placeholder{
font-family: 'HangeulNuriB'
}
.inputSize{ .inputSize{
width: 15.3rem; width: 15.3rem;
} }
...@@ -37,6 +54,7 @@ input[type="number"]::-webkit-inner-spin-button { ...@@ -37,6 +54,7 @@ input[type="number"]::-webkit-inner-spin-button {
color: black; color: black;
background-color: #FEDC00; background-color: #FEDC00;
border: 1px solid black; border: 1px solid black;
text-align: center;
} }
.btnHover:hover{ .btnHover:hover{
...@@ -44,6 +62,7 @@ background-color: black; ...@@ -44,6 +62,7 @@ background-color: black;
color: #FEDC00; color: #FEDC00;
transition: ease-out; transition: ease-out;
border: 1px solid white ; border: 1px solid white ;
text-align: center;
} }
.btnHover:focus{ .btnHover:focus{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment