Skip to content

Commit

Permalink
feat : 로그인 페이지로 이동 가능하게 추가 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeonseo-Jo committed Nov 17, 2023
1 parent 30410aa commit 0f0d54c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
4 changes: 2 additions & 2 deletions week4-api-signin/src/Router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { BrowserRouter, Route, Routes } from "react-router-dom";
import Login from "./pages/Login";
import SignUp from "./pages/SignUp";
import MyPage from "./pages/MyPage";
import PageLayout from "./components/PageLayout";
import Home from "./pages/Home";

const Router = () => {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<PageLayout />} />
<Route path="/" element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<SignUp />} />
<Route path="/mypage/:userId" element={<MyPage />} />
Expand Down
7 changes: 6 additions & 1 deletion week4-api-signin/src/components/PageLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { useNavigate } from "react-router-dom";
import styled from "styled-components";

const PageLayout = ({ children }) => {
const navigate = useNavigate();

return (
<St.PageLayoutBackGround>
<St.PageLayoutBody>
<St.PageLayoutTopBar>
<TopBarBlueBtn type="button">_</TopBarBlueBtn>
<TopBarBlueBtn type="button"></TopBarBlueBtn>
<TopBarRedBtn type="button">X</TopBarRedBtn>
<TopBarRedBtn type="button" onClick={() => navigate("/")}>
X
</TopBarRedBtn>
</St.PageLayoutTopBar>

<St.PageLayoutContentsContainer>
Expand Down
36 changes: 36 additions & 0 deletions week4-api-signin/src/pages/Home.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import styled from "styled-components";
import PageLayout from "../components/PageLayout";

import { useNavigate } from "react-router-dom";

const Home = () => {
const navigate = useNavigate();

return (
<PageLayout>
<St.GoToLoginBtn type="button" onClick={() => navigate("/login")}>
로그인 하러 가기
</St.GoToLoginBtn>
</PageLayout>
);
};

export default Home;

const St = {
GoToLoginBtn: styled.button`
width: 20rem;
height: 5rem;
border-radius: 1rem;
background-color: ${({ theme }) => theme.colors.blue};
color: ${({ theme }) => theme.colors.white};
font-size: 2rem;
&::hover {
box-shadow: 0 0 1rem ${({ theme }) => theme.colors.blue};
}
`,
};

0 comments on commit 0f0d54c

Please sign in to comment.