Skip to content

Commit

Permalink
Merge branch 'test' into whywhywwwhy/#38/PortfolioServer
Browse files Browse the repository at this point in the history
  • Loading branch information
ftery0 authored Apr 6, 2024
2 parents bad5781 + 3278209 commit 0dbefde
Show file tree
Hide file tree
Showing 61 changed files with 1,812 additions and 1,718 deletions.
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

3 changes: 2 additions & 1 deletion SOPOLAST/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
package-lock.json
.env
.env
config
Binary file added SOPOLAST/public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion SOPOLAST/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="ko">
<head>
<meta charset="utf-8" />
<link rel="apple-touch-icon" href="#" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand Down
40 changes: 3 additions & 37 deletions SOPOLAST/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,9 @@
import React from "react";
import GlobalStyles from "src/Style/global";
import Updown from "src/Components/Updown/updownmain";
import Login from "src/Components/Auth/Login/login";
import Portfolio from "src/Components/Portfolio/portfolioMain";
import Main from "src/Components/Home/MainPage/mainpage";
import Write from "src/Components/Sidewrite/write";
import Signup from "src/Components/Auth/Signup/signup";
import Mypage from "src/Components/Mypage/mypage";
import Competition from "src/Components/Competition/Competition";
import Portfoliosub from "src/Components/Portfoliosub/portfolioSub";
import Updownsub from "src/Components/Updownsub/postshow";
import CompetitionSub from "src/Components/compsub/competitionsub";
import Park from "src/Components/park";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import { RecoilRoot } from "recoil";
import Router from "src/Components/Router/index";

function App() {
return (
<BrowserRouter>
<RecoilRoot>
<GlobalStyles />
<div className="App">
<Routes>
<Route path="/" element={<Login />} />
<Route path="/main" element={<Main />} />
<Route path="/portfolio" element={<Portfolio />} />
<Route path="/Mentor-Mentee" element={<Updown />} />
<Route path="/sidewrite" element={<Write />} />
<Route path="/Signuppage" element={<Signup />} />
<Route path="/Mypage" element={<Mypage />} />
<Route path="/Competition" element={<Competition />} />
<Route path="/52562893" element={<Portfoliosub />} />
<Route path="/Updownsub" element={<Updownsub />} />
<Route path="/CompetitionSub" element={<CompetitionSub />} />
<Route path="/12362153" element={<Park />} />
</Routes>
</div>
</RecoilRoot>
</BrowserRouter>
<Router/>

);
}

Expand Down
10 changes: 0 additions & 10 deletions SOPOLAST/src/Components/Auth/Login/login.css

This file was deleted.

125 changes: 43 additions & 82 deletions SOPOLAST/src/Components/Auth/Login/login.tsx
Original file line number Diff line number Diff line change
@@ -1,103 +1,64 @@
import React, { useState } from "react";
import React from "react";
import { useNavigate } from "react-router-dom";
import { Link } from "react-router-dom";
import { useRecoilState } from "recoil";
import { userState } from "../../../recoil/auto";
import * as s from "../style/Auth.style";
import LOGO from "../../../Assets/image/LOGO.png";
import { loginUser } from "../../../hooks/LoginCraft/LoginCraft";
import { showToast } from "../../../constants/Swal/Swal";
import { useLogin } from "src/hooks/auth/UseLogin";
import * as S from "../style/Auth.style";
import LOGO from "src/Assets/image/LOGO.png";

interface UserData {
email: string;
password: string;
}

const LoginComponent: React.FC = () => {
const LoginComponent = () => {
const navigate = useNavigate();
const [email, setEmail] = useState<string>("");
const [password, setPassword] = useState<string>("");
const [loading, setLoading] = useState<boolean>(false);
const [keepLoggedIn, setKeepLoggedIn] = useState<boolean>(false); // 로그인 유지하기 상태

const handleLogin = async () => {
if (email === "" || password === "") {
showToast("warning", "이메일과 비밀번호를 모두 입력해주세요");
return;
}

try {
setLoading(true);
const userData: UserData = {
email: email,
password: password,
};
const response = await loginUser(userData);
setLoading(false);
if (response) {
showToast("success", "로그인 성공");
navigate("/main");
} else {
showToast("error", "로그인에 실패하였습니다");
}
} catch (error) {
console.log(error);
showToast("error", "서버 통신 실패.");
}
};

const handleKeepLoggedIn = () => {
setKeepLoggedIn(!keepLoggedIn);
};
const {
...login
} = useLogin();

return (
<s.App1>
<s.Login_Main>
<s.GreenBox>
<s.Img src={LOGO} alt="로고"></s.Img>
</s.GreenBox>
<s.Box1>
<s.Box_Group>
<s.Form className="form">
<s.Title>Log in</s.Title>
<s.Input
<S.App1>
<S.Login_Main>
<S.GreenBox>
<S.Img src={LOGO} alt="로고"></S.Img>
</S.GreenBox>
<S.Box1>
<S.Box_Group>
<S.Form className="form">
<S.Title>Log in</S.Title>
<S.Input
type="text"
placeholder="E-Mail"
value={email}
onChange={(e) => setEmail(e.target.value)}
></s.Input>
<s.Input
value={login.email}
onChange={login.onChangeEmail}
></S.Input>
<S.Input
type="password"
placeholder="Password"
value={password}
onChange={(e) => setPassword(e.target.value)}
></s.Input>
<s.CheckboxWrapper>
<s.CheckboxBundle>
<s.Checkbox
value={login.password}
onChange={login.onChangePassword}
></S.Input>
<S.CheckboxWrapper>
<S.CheckboxBundle>
<S.Checkbox
type="checkbox"
id="keepLoggedInCheckbox" // 체크박스에 id 추가
checked={keepLoggedIn}
onChange={handleKeepLoggedIn}
checked={login.keepLoggedIn}
onChange={login.handleKeepLoggedIn}
/>

<s.CheckboxLabel htmlFor="keepLoggedInCheckbox">
<S.CheckboxLabel htmlFor="keepLoggedInCheckbox">
로그인 유지
</s.CheckboxLabel>
</s.CheckboxBundle>
</s.CheckboxWrapper>
<s.Button type="button" onClick={handleLogin}>
</S.CheckboxLabel>
</S.CheckboxBundle>
</S.CheckboxWrapper>
<S.Button type="button" onClick={login.handleLogin}>
Log in
</s.Button>
</S.Button>

<s.SignLink onClick={() => navigate("/Signuppage")}>
<S.SignLink onClick={() => navigate("/Signuppage")}>
sign up
</s.SignLink>
</s.Form>
</s.Box_Group>
</s.Box1>
</s.Login_Main>
</s.App1>
</S.SignLink>
</S.Form>
</S.Box_Group>
</S.Box1>
</S.Login_Main>
</S.App1>
);
};

Expand Down
72 changes: 0 additions & 72 deletions SOPOLAST/src/Components/Auth/Signup/signup.css

This file was deleted.

Loading

0 comments on commit 0dbefde

Please sign in to comment.