Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix : eeor
Browse files Browse the repository at this point in the history
  • Loading branch information
ftery0 committed Aug 26, 2024
1 parent f73fdd6 commit 9793ec8
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 141 deletions.
85 changes: 48 additions & 37 deletions web/src/components/auth/default/index.tsx
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;
84 changes: 51 additions & 33 deletions web/src/components/auth/login/index.tsx
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: React.FC = () => {
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;
73 changes: 39 additions & 34 deletions web/src/components/auth/name/index.tsx
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;
79 changes: 44 additions & 35 deletions web/src/components/auth/number/index.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,58 @@
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 Number = (s: string)=>{
const Number = () => {
const navigate = useNavigate();
const [AuthValid, setAuthValid] = useAtom(authType);
const consumerAuth = ()=>{
setAuthValid((prev)=>!prev);

navigate("/login")

}
return(
<S.login>
<Auth.main>
<Auth.loginText>
const [users, setUsers] = useAtom(usersAtom);
const [currentUser, setCurrentUser] = useAtom(currentUserAtom);
const [phone, setPhone] = useState("");

const handleSignUp = () => {
const newUser = {
...currentUser,
phone,
};

setUsers([...users, newUser]);
setCurrentUser(null);

navigate("/login");
};

return (
<S.login>
<Auth.main>
<Auth.loginText>
<h2>안녕하세요</h2>
</Auth.loginText>
<S.buttonMain>
<S.textFieldWrap>
<S.textField placeholder="전화번호를 입력해주세요" />
<S.textFieldWrap>
<S.textField
placeholder="전화번호를 입력해주세요"
value={phone}
onChange={(e) => setPhone(e.target.value)}
/>
</S.textFieldWrap>
<S.bottomWarp>
<S.startButton onClick={()=>navigate("/login")}>회원가입</S.startButton>
<S.navText>

<span onClick={()=>navigate("/sign")}>로그인 하러 가기</span>
</S.navText>
<S.startButton onClick={handleSignUp}>회원가입</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 Number
</S.login>
);
};

export default Number;
Loading

0 comments on commit 9793ec8

Please sign in to comment.