Showing
4 changed files
with
89 additions
and
1 deletions
| ... | @@ -2,6 +2,7 @@ import React from "react"; | ... | @@ -2,6 +2,7 @@ import React from "react"; |
| 2 | import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; | 2 | import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; |
| 3 | 3 | ||
| 4 | import EditorPage from "pages/Editor"; | 4 | import EditorPage from "pages/Editor"; |
| 5 | +import LoginPage from "pages/Login"; | ||
| 5 | 6 | ||
| 6 | import "./App.css"; | 7 | import "./App.css"; |
| 7 | 8 | ||
| ... | @@ -10,7 +11,8 @@ function App() { | ... | @@ -10,7 +11,8 @@ function App() { |
| 10 | <div className="App"> | 11 | <div className="App"> |
| 11 | <Router> | 12 | <Router> |
| 12 | <Switch> | 13 | <Switch> |
| 13 | - <Route path="/" component={EditorPage} /> | 14 | + <Route path="/editor" component={EditorPage} /> |
| 15 | + <Route path="/" component={LoginPage} /> | ||
| 14 | </Switch> | 16 | </Switch> |
| 15 | </Router> | 17 | </Router> |
| 16 | </div> | 18 | </div> | ... | ... |
project/src/pages/Login/LoginPage.scss
0 → 100644
| 1 | +.login-page { | ||
| 2 | + width: 50%; | ||
| 3 | + margin: auto; | ||
| 4 | + box-shadow: 0 0 10px rgba(0,0,0,.1); | ||
| 5 | + padding: 70px 50px; | ||
| 6 | + margin-top: 100px; | ||
| 7 | + border-radius: 20px; | ||
| 8 | + | ||
| 9 | + .login-field { | ||
| 10 | + input { | ||
| 11 | + display: block; | ||
| 12 | + margin: auto; | ||
| 13 | + margin-bottom: 10px; | ||
| 14 | + width: 200px; | ||
| 15 | + height: 30px; | ||
| 16 | + font-size: 14px; | ||
| 17 | + border-radius: 5px; | ||
| 18 | + border: 1px solid lightgray; | ||
| 19 | + padding-left: 10px; | ||
| 20 | + | ||
| 21 | + &:focus { | ||
| 22 | + outline: none; | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + p { | ||
| 28 | + font-size: 13px; | ||
| 29 | + margin-top: 30px; | ||
| 30 | + | ||
| 31 | + button { | ||
| 32 | + border: none; | ||
| 33 | + cursor: pointer; | ||
| 34 | + | ||
| 35 | + &:hover { | ||
| 36 | + color: darkslateblue; | ||
| 37 | + transition: 0.2s; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + &:focus { | ||
| 41 | + outline: none; | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +@media (max-width: 767px) { | ||
| 48 | + .login-page { | ||
| 49 | + width: 90%; | ||
| 50 | + margin: 10px auto; | ||
| 51 | + padding: 20px 0; | ||
| 52 | + } | ||
| 53 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
project/src/pages/Login/LoginPage.tsx
0 → 100644
| 1 | +import React, { useState } from "react"; | ||
| 2 | + | ||
| 3 | +import "./LoginPage.scss"; | ||
| 4 | + | ||
| 5 | +function LoginPage() { | ||
| 6 | + const [loginMode, setLoginMode]: [boolean, Function] = useState(true); | ||
| 7 | + const [id, setId] = useState(''); | ||
| 8 | + const [password, setPassword] = useState(''); | ||
| 9 | + | ||
| 10 | + return ( | ||
| 11 | + <div className="login-page"> | ||
| 12 | + {loginMode ? ( | ||
| 13 | + <> | ||
| 14 | + <h2>로그인</h2> | ||
| 15 | + <div className="login-field"> | ||
| 16 | + <input type="text" placeholder="아이디" value={id} onChange={e => setId(e.target.value)}/> | ||
| 17 | + <input type="password" placeholder="패스워드" value={password} onChange={e => setPassword(e.target.value)} /> | ||
| 18 | + </div> | ||
| 19 | + <button>로그인</button> | ||
| 20 | + <p>아직 회원이 아니라면 <button onClick={() => setLoginMode(false)}>회원가입</button>을 먼저 진행해주세요.</p> | ||
| 21 | + </> | ||
| 22 | + ) : ( | ||
| 23 | + <> | ||
| 24 | + <h2>회원가입</h2> | ||
| 25 | + <button onClick={() => setLoginMode(true)}>로그인하기</button> | ||
| 26 | + </> | ||
| 27 | + )} | ||
| 28 | + </div> | ||
| 29 | + ); | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +export default LoginPage; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
project/src/pages/Login/index.ts
0 → 100644
| 1 | +export { default } from "./LoginPage"; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment