Skip to content

Commit

Permalink
Docs:회원가입시 닉네임 입력란 추가 #9
Browse files Browse the repository at this point in the history
  • Loading branch information
Yongsu01 committed Feb 13, 2024
1 parent 4bb43da commit 2ed84ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/SignInUpPage/SignUpBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const Contents = styled.div`
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 70px;
margin-top: 50px;
height:100%;
text-align: center;
`;
Expand Down
36 changes: 23 additions & 13 deletions src/SignInUpPage/SignUpForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@ import { useState } from "react";
import styled from "styled-components";

interface SignUpFormProps{
onSubmit: (username: string, password: string, email:string) => void
onSubmit: (username: string, password: string, email:string, nickname: string) => void
}
const SignUpForm:React.FC<SignUpFormProps> = ({onSubmit}) =>{
const [username,setUsername] = useState('');
const [password, setPassword] = useState('');
const [email, setEmail] = useState('');
const [nickname, setNickname] = useState('');

const handleSignUp= (e:React.FormEvent)=>{
e.preventDefault();
onSubmit(username,password,email);
onSubmit(username,password,email,nickname);
};

return(
<StyledForm onSubmit={handleSignUp}>
<StyledLabel htmlFor="Id">
<StyledLabel htmlFor="Email">
<StyledInput
id="Id"
id="Email"
type="text"
placeholder="아이디"
value={username}
onChange={(e)=>setUsername(e.target.value)}
placeholder="이메일"
value={email}
onChange={(e)=>setEmail(e.target.value)}
required/>
<StyledDIv/>
</StyledLabel>
Expand All @@ -37,13 +38,23 @@ const SignUpForm:React.FC<SignUpFormProps> = ({onSubmit}) =>{
required/>
<StyledDIv/>
</StyledLabel>
<StyledLabel htmlFor="Email">
<StyledLabel htmlFor="Username">
<StyledInput
id="Email"
id="Username"
type="text"
placeholder="이메일"
value={email}
onChange={(e)=>setEmail(e.target.value)}
placeholder="이름"
value={username}
onChange={(e)=>setUsername(e.target.value)}
required/>
<StyledDIv/>
</StyledLabel>
<StyledLabel htmlFor="Nickname">
<StyledInput
id="Nickname"
type="text"
placeholder="닉네임"
value={nickname}
onChange={(e)=>setNickname(e.target.value)}
required/>
<StyledDIv/>
</StyledLabel>
Expand Down Expand Up @@ -73,7 +84,6 @@ const StyledButton = styled.button`
background-color: white;
height: 50px;
width:85%;
top:20px;
font-weight: bold;
`;

Expand Down

0 comments on commit 2ed84ed

Please sign in to comment.