This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Origin/hae
- Loading branch information
Showing
10 changed files
with
292 additions
and
166 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,63 @@ | ||
import React from "react" | ||
import Polygon from "../../../assets/Polygon 2.png"; | ||
import logo from "../../../assets/logo.svg"; | ||
import React, { useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { useAtom } from "jotai"; | ||
import { currentUserAtom } from "../../../store/user/user.atom"; | ||
import * as S from "./style"; | ||
import * as Auth from "../start/style"; | ||
import { useAtom } from "jotai"; | ||
import { authType } from "../../../store/authtype/authtype.atom"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
import Polygon from "../../../assets/Polygon 2.png"; | ||
import logo from "../../../assets/logo.svg"; | ||
|
||
const Default = ()=>{ | ||
const Default= () => { | ||
const navigate = useNavigate(); | ||
const [AuthValid, setAuthValid] = useAtom(authType); | ||
const consumerAuth = ()=>{ | ||
setAuthValid((prev)=>!prev); | ||
|
||
navigate("/login") | ||
|
||
} | ||
return( | ||
<S.login> | ||
<Auth.main> | ||
<S.loginText> | ||
const [, setCurrentUser] = useAtom(currentUserAtom); | ||
const [username, setUsername] = useState(""); | ||
const [password, setPassword] = useState(""); | ||
|
||
const handleNext = () => { | ||
setCurrentUser((prev) => ({ | ||
...prev, | ||
username, | ||
password | ||
})); | ||
navigate("/sign/number/"); | ||
}; | ||
|
||
return ( | ||
<S.login> | ||
<Auth.main> | ||
<Auth.loginText> | ||
<h2>안녕하세요</h2> | ||
</S.loginText> | ||
</Auth.loginText> | ||
<S.buttonMain> | ||
<S.textFieldWrap> | ||
<S.textField placeholder="아이디를 입력해주세요" /> | ||
<S.textFieldWrap> | ||
<S.textField | ||
placeholder="아이디를 입력해주세요" | ||
value={username} | ||
onChange={(e) => setUsername(e.target.value)} | ||
/> | ||
</S.textFieldWrap> | ||
<S.textFieldWrap> | ||
<S.textField type="password" placeholder="비밀번호를 입력해주세요" /> | ||
<S.textField | ||
type="password" | ||
placeholder="비밀번호를 입력해주세요" | ||
value={password} | ||
onChange={(e) => setPassword(e.target.value)} | ||
/> | ||
</S.textFieldWrap> | ||
<S.bottomWarp> | ||
<S.startButton onClick={()=>navigate("/sign/number")}>다음</S.startButton> | ||
<S.navText> | ||
|
||
<span onClick={()=>navigate("/sign")}>로그인 하러 가기</span> | ||
</S.navText> | ||
<S.startButton onClick={handleNext}>다음</S.startButton> | ||
<S.navText> | ||
<span onClick={() => navigate("/sign/")}>로그인 하러 가기</span> | ||
</S.navText> | ||
</S.bottomWarp> | ||
</S.buttonMain> | ||
|
||
<img src={Polygon}></img> | ||
<img src={Polygon} alt="Polygon" /> | ||
</Auth.main> | ||
<Auth.logoMain> | ||
<Auth.logo src={logo}> | ||
|
||
</Auth.logo> | ||
<Auth.logo src={logo} alt="Logo" /> | ||
</Auth.logoMain> | ||
</S.login> | ||
) | ||
} | ||
export default Default | ||
</S.login> | ||
); | ||
}; | ||
|
||
export default Default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,67 @@ | ||
import React from "react" | ||
import Polygon from "../../../assets/Polygon 2.png"; | ||
import logo from "../../../assets/logo.svg"; | ||
import React, { useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { useAtom } from "jotai"; | ||
import { usersAtom, currentUserAtom } from "../../../store/user/user.atom"; | ||
import * as S from "./style"; | ||
import * as Auth from "../start/style"; | ||
import { useAtom } from "jotai"; | ||
import { authType } from "../../../store/authtype/authtype.atom"; | ||
import { useNavigate } from "react-router-dom"; | ||
import Polygon from "../../../assets/Polygon 2.png"; | ||
import logo from "../../../assets/logo.svg"; | ||
|
||
const Login = ()=>{ | ||
const Login = () => { | ||
const navigate = useNavigate(); | ||
const [AuthValid, setAuthValid] = useAtom(authType); | ||
const consumerAuth = ()=>{ | ||
setAuthValid((prev)=>!prev); | ||
} | ||
return( | ||
<S.login> | ||
<Auth.main> | ||
<S.loginText> | ||
const [users] = useAtom(usersAtom); | ||
const [, setCurrentUser] = useAtom(currentUserAtom); | ||
const [username, setUsername] = useState(""); | ||
const [password, setPassword] = useState(""); | ||
|
||
const handleLogin = () => { | ||
const user = users.find( | ||
(u) => u.username === username && u.password === password | ||
); | ||
if (user) { | ||
setCurrentUser(user); | ||
navigate("/home/"); | ||
} else { | ||
alert("아이디 또는 비밀번호가 틀렸습니다."); | ||
} | ||
}; | ||
|
||
return ( | ||
<S.login> | ||
<Auth.main> | ||
<S.loginText> | ||
<h2>반가워요!</h2> | ||
</S.loginText> | ||
<S.buttonMain> | ||
<S.textFieldWrap> | ||
<S.textField placeholder="아이디를 입력해주세요" /> | ||
<S.textField | ||
placeholder="아이디를 입력해주세요" | ||
value={username} | ||
onChange={(e) => setUsername(e.target.value)} | ||
/> | ||
</S.textFieldWrap> | ||
<S.textFieldWrap > | ||
<S.textField type="password" placeholder="비밀번호를 입력해주세요" /> | ||
<S.textFieldWrap> | ||
<S.textField | ||
type="password" | ||
placeholder="비밀번호를 입력해주세요" | ||
value={password} | ||
onChange={(e) => setPassword(e.target.value)} | ||
/> | ||
</S.textFieldWrap> | ||
<S.bottomWarp> | ||
<S.startButton onClick={()=>navigate("/home")}>시작</S.startButton> | ||
<S.navText> | ||
{AuthValid ? <span onClick={consumerAuth}>사용자 로그인 하러 가기</span> : <span onClick={consumerAuth}>지자체 로그인 하러 가기</span>} | ||
<span onClick={()=>navigate("/sign/name")}>회원가입 하러 가기</span> | ||
</S.navText> | ||
<S.startButton onClick={handleLogin}>시작</S.startButton> | ||
<S.navText> | ||
<span onClick={() => navigate("/sign/name/")}>회원가입 하러 가기</span> | ||
</S.navText> | ||
</S.bottomWarp> | ||
|
||
</S.buttonMain> | ||
|
||
<img src={Polygon}></img> | ||
<img src={Polygon} alt="Polygon" /> | ||
</Auth.main> | ||
<Auth.logoMain> | ||
<Auth.logo src={logo}> | ||
|
||
</Auth.logo> | ||
<Auth.logo src={logo} alt="Logo" /> | ||
</Auth.logoMain> | ||
</S.login> | ||
) | ||
} | ||
export default Login | ||
</S.login> | ||
); | ||
}; | ||
|
||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,53 @@ | ||
import React from "react" | ||
import Polygon from "../../../assets/Polygon 2.png"; | ||
import logo from "../../../assets/logo.svg"; | ||
import React, { useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { useAtom } from "jotai"; | ||
import { currentUserAtom } from "../../../store/user/user.atom"; | ||
import * as S from "./style"; | ||
import * as Auth from "../start/style"; | ||
import { useAtom } from "jotai"; | ||
import { authType } from "../../../store/authtype/authtype.atom"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
import Polygon from "../../../assets/Polygon 2.png"; | ||
import logo from "../../../assets/logo.svg"; | ||
|
||
const Name = ()=>{ | ||
const Name= () => { | ||
const navigate = useNavigate(); | ||
const [AuthValid, setAuthValid] = useAtom(authType); | ||
const consumerAuth = ()=>{ | ||
setAuthValid((prev)=>!prev); | ||
|
||
navigate("/login") | ||
|
||
} | ||
return( | ||
<S.login> | ||
<Auth.main> | ||
<Auth.loginText> | ||
const [, setCurrentUser] = useAtom(currentUserAtom); | ||
const [name, setName] = useState(""); | ||
|
||
const handleNext = () => { | ||
setCurrentUser((prev) => ({ | ||
...prev, | ||
name | ||
})); | ||
navigate("/signup"); | ||
}; | ||
|
||
return ( | ||
<S.login> | ||
<Auth.main> | ||
<Auth.loginText> | ||
<h2>안녕하세요</h2> | ||
</Auth.loginText> | ||
<S.buttonMain> | ||
<S.textFieldWrap> | ||
<S.textField placeholder="이름을 입력해주세요" /> | ||
<S.textFieldWrap> | ||
<S.textField | ||
placeholder="이름을 입력해주세요" | ||
value={name} | ||
onChange={(e) => setName(e.target.value)} | ||
/> | ||
</S.textFieldWrap> | ||
<S.bottomWarp> | ||
<S.startButton onClick={()=>navigate("/signup")}>다음</S.startButton> | ||
<S.navText> | ||
<span onClick={()=>navigate("/sign")}>로그인 하러 가기</span> | ||
</S.navText> | ||
<S.startButton onClick={handleNext}>다음</S.startButton> | ||
<S.navText> | ||
<span onClick={() => navigate("/sign")}>로그인 하러 가기</span> | ||
</S.navText> | ||
</S.bottomWarp> | ||
</S.buttonMain> | ||
|
||
<img src={Polygon}></img> | ||
<img src={Polygon} alt="Polygon" /> | ||
</Auth.main> | ||
<Auth.logoMain> | ||
<Auth.logo src={logo}> | ||
|
||
</Auth.logo> | ||
<Auth.logo src={logo} alt="Logo" /> | ||
</Auth.logoMain> | ||
</S.login> | ||
) | ||
} | ||
export default Name | ||
</S.login> | ||
); | ||
}; | ||
|
||
export default Name; |
Oops, something went wrong.