//App.js
import './App.css';
import React from "react";
import { Route } from "react-router-dom";
import PostListPage from "./pages/PostListPage";
import LoginPage from "./pages/LoginPage";
import PostPage from "./pages/PostPage";
import RegisterPage from "./pages/RegisterPage";
import WritePage from "./pages/WritePage";
const App = () => {
return (
<>
{/* "/@:username" username ํ๋ผ๋ฏธํฐ๋ฅผ ์ฝ์ ์ ์๊ฒ ํด์ค */}
<Route component={PostListPage} path={["/@:username", "/"]} exact />
<Route component={LoginPage} path={["/login"]} />
<Route component={RegisterPage} path={["/register"]} />
<Route component={WritePage} path={["/write"]} />
<Route component={PostPage} path={["/@:username/:postId"]} />
</>
)
}
export default App;
//AuthForm.js
import React from "react";
import styled from "styled-components";
import { Link } from "react-router-dom";
import palette from "../../lib/styles/palette";
import Button from "../common/Button";
// ํ์๊ฐ์
๋๋ ๋ก๊ทธ์ธ ํผ์ ๋ณด์ฌ์ค๋๋ค.
const AuthFormBlock = styled.div`
h3 {
margin:0;
color:${palette.gray[8]};
margin-bottom:1rem;
}
`;
(...)
const AuthForm = () => {
return (
<AuthFormBlock>
<h3>๋ก๊ทธ์ธ</h3>
<form>
<StyledInput autoComplete="username" name="username" placeholder="์์ด๋" />
<StyledInput autoComplete="new-password" name="password" placeholder="๋น๋ฐ๋ฒํธ" type="password" />
<Button>๋ก๊ทธ์ธ</Button>
</form>
<Footer>
<Link to="/register">ํ์๊ฐ์
</Link>
</Footer>
</AuthFormBlock>
);
};
export default AuthForm;
์ฐธ์กฐ : ๋ฆฌ์กํธ๋ฅผ ๋ค๋ฃจ๋ ๊ธฐ์