Showing
7 changed files
with
96 additions
and
82 deletions
... | @@ -5,6 +5,7 @@ import Auth from "../hoc/auth"; | ... | @@ -5,6 +5,7 @@ import Auth from "../hoc/auth"; |
5 | import LandingPage from "./views/LandingPage/LandingPage.js"; | 5 | import LandingPage from "./views/LandingPage/LandingPage.js"; |
6 | import LoginPage from "./views/LoginPage/LoginPage.js"; | 6 | import LoginPage from "./views/LoginPage/LoginPage.js"; |
7 | import RegisterPage from "./views/RegisterPage/RegisterPage.js"; | 7 | import RegisterPage from "./views/RegisterPage/RegisterPage.js"; |
8 | +import UploadPage from './views/UploadPage/UploadPage'; | ||
8 | import NavBar from "./views/NavBar/NavBar"; | 9 | import NavBar from "./views/NavBar/NavBar"; |
9 | import Footer from "./views/Footer/Footer" | 10 | import Footer from "./views/Footer/Footer" |
10 | 11 | ||
... | @@ -21,6 +22,7 @@ function App() { | ... | @@ -21,6 +22,7 @@ function App() { |
21 | <Route exact path="/" component={Auth(LandingPage, null)} /> | 22 | <Route exact path="/" component={Auth(LandingPage, null)} /> |
22 | <Route exact path="/login" component={Auth(LoginPage, false)} /> | 23 | <Route exact path="/login" component={Auth(LoginPage, false)} /> |
23 | <Route exact path="/register" component={Auth(RegisterPage, false)} /> | 24 | <Route exact path="/register" component={Auth(RegisterPage, false)} /> |
25 | + <Route exact path="/upload" component={Auth(UploadPage, true)} /> | ||
24 | </Switch> | 26 | </Switch> |
25 | </div> | 27 | </div> |
26 | <Footer /> | 28 | <Footer /> | ... | ... |
... | @@ -36,6 +36,9 @@ function RightMenu(props) { | ... | @@ -36,6 +36,9 @@ function RightMenu(props) { |
36 | } else { | 36 | } else { |
37 | return ( | 37 | return ( |
38 | <Menu mode={props.mode}> | 38 | <Menu mode={props.mode}> |
39 | + <Menu.Item key="upload"> | ||
40 | + <a href="/upload">업로드</a> | ||
41 | + </Menu.Item> | ||
39 | <Menu.Item key="logout"> | 42 | <Menu.Item key="logout"> |
40 | <a onClick={logoutHandler}>로그아웃</a> | 43 | <a onClick={logoutHandler}>로그아웃</a> |
41 | </Menu.Item> | 44 | </Menu.Item> | ... | ... |
1 | -import React from 'react'; | ||
2 | -import { Menu } from 'antd'; | ||
3 | -const SubMenu = Menu.SubMenu; | ||
4 | -const MenuItemGroup = Menu.ItemGroup; | ||
5 | - | ||
6 | -function LeftMenu(props) { | ||
7 | - return ( | ||
8 | - <Menu mode={props.mode}> | ||
9 | - <Menu.Item key="mail"> | ||
10 | - <a href="/">Home</a> | ||
11 | - </Menu.Item> | ||
12 | - <SubMenu title={<span>Blogs</span>}> | ||
13 | - <MenuItemGroup title="Item 1"> | ||
14 | - <Menu.Item key="setting:1">Option 1</Menu.Item> | ||
15 | - <Menu.Item key="setting:2">Option 2</Menu.Item> | ||
16 | - </MenuItemGroup> | ||
17 | - <MenuItemGroup title="Item 2"> | ||
18 | - <Menu.Item key="setting:3">Option 3</Menu.Item> | ||
19 | - <Menu.Item key="setting:4">Option 4</Menu.Item> | ||
20 | - </MenuItemGroup> | ||
21 | - </SubMenu> | ||
22 | - </Menu> | ||
23 | - ) | ||
24 | -} | ||
25 | - | ||
26 | -export default LeftMenu | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
File mode changed
1 | -/* eslint-disable jsx-a11y/anchor-is-valid */ | ||
2 | -import React from 'react'; | ||
3 | -import { Menu } from 'antd'; | ||
4 | -import axios from 'axios'; | ||
5 | -//import { USER_SERVER } from '../../../Config'; | ||
6 | -import { withRouter } from 'react-router-dom'; | ||
7 | -import { useSelector } from "react-redux"; | ||
8 | - | ||
9 | -function RightMenu(props) { | ||
10 | - const user = useSelector(state => state.user) | ||
11 | - | ||
12 | - const logoutHandler = () => { | ||
13 | - axios.get('/api/users/logout').then(response => { | ||
14 | - if (response.status === 200) { | ||
15 | - props.history.push("/login"); | ||
16 | - } else { | ||
17 | - alert('Log Out Failed') | ||
18 | - } | ||
19 | - }); | ||
20 | - }; | ||
21 | - | ||
22 | - //console.log(user.userData) | ||
23 | - //console.log(!user.userData.isAuth) | ||
24 | - if (user.userData && !user.userData.isAuth) { | ||
25 | - return ( | ||
26 | - <Menu mode={props.mode}> | ||
27 | - <Menu.Item key="mail"> | ||
28 | - <a href="/login">Signin</a> | ||
29 | - </Menu.Item> | ||
30 | - <Menu.Item key="app"> | ||
31 | - <a href="/register">Signup</a> | ||
32 | - </Menu.Item> | ||
33 | - </Menu> | ||
34 | - ) | ||
35 | - } else { | ||
36 | - return ( | ||
37 | - <Menu mode={props.mode}> | ||
38 | - <Menu.Item key="logout"> | ||
39 | - <a onClick={logoutHandler}>Logout</a> | ||
40 | - </Menu.Item> | ||
41 | - </Menu> | ||
42 | - ) | ||
43 | - } | ||
44 | -} | ||
45 | - | ||
46 | -export default withRouter(RightMenu); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -import React from 'react' | 1 | +import React from 'react'; |
2 | +import { useState } from 'react'; | ||
3 | +import { Typography, Button, Form, Input } from 'antd'; // css | ||
4 | + | ||
5 | + | ||
6 | +const { TextArea } = Input; // 박스크기 조절을 사용자가 임의로 가능하게 함. | ||
7 | + | ||
8 | +// Options | ||
9 | +const options = [{ key: 1, value: "a" }, | ||
10 | + { key: 2, value: "b" }, | ||
11 | + {key: 3, value : "c"} | ||
12 | +] | ||
2 | 13 | ||
3 | function UploadPage() { | 14 | function UploadPage() { |
15 | + | ||
16 | + // OnChange Function | ||
17 | + | ||
18 | + const [Image, setImage] = useState("") | ||
19 | + const [Title, setTitle] = useState(""); | ||
20 | + const [Info, setInfo] = useState(""); | ||
21 | + const [Cost, setCost] = useState(""); | ||
22 | + const [Option, setOption] = useState(1); | ||
23 | + | ||
24 | + const titleEvent = (event) => { | ||
25 | + setTitle(event.currentTarget.value); | ||
26 | + } | ||
27 | + | ||
28 | + const infoEvent = (event) => { | ||
29 | + setInfo(event.currentTarget.value); | ||
30 | + } | ||
31 | + | ||
32 | + const costEvent = (event) => { | ||
33 | + setCost(event.currentTarget.value); | ||
34 | + } | ||
35 | + | ||
36 | + | ||
37 | + const optionEvent = (event) => { | ||
38 | + setOption(event.currentTarget.value); | ||
39 | + } | ||
40 | + | ||
41 | + | ||
42 | + const imageEvent = (event) => { | ||
43 | + setImage(event.currentTarget.value); | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
4 | return ( | 50 | return ( |
5 | - <div> | 51 | + <div style={{ maxWidth: '700px', margin: '2rem auto' }}> |
6 | - uploadpage | 52 | + |
53 | + <div style={{ textAlign: 'center', marginBottom:'2rem'}}> | ||
54 | + <h2> 업로드 </h2> | ||
55 | + | ||
56 | + </div> | ||
57 | + | ||
58 | + <Form> | ||
59 | + | ||
60 | + <br /> | ||
61 | + <br /> | ||
62 | + <label>이름</label> | ||
63 | + <Input onChange={ titleEvent} value={Title} /> | ||
64 | + {/* ㄴ ant design에서 가져온 Input */} | ||
65 | + <br /> | ||
66 | + <br /> | ||
67 | + <label>설명</label> | ||
68 | + <TextArea onChange={ infoEvent} value={Info} /> | ||
69 | + <br /> | ||
70 | + <br /> | ||
71 | + <label>가격</label> | ||
72 | + <Input onChange={ costEvent} value={Cost} type="number"/> | ||
73 | + <br /> | ||
74 | + <br /> | ||
75 | + <select onChange={optionEvent} value={ Option}> | ||
76 | + {options.map(item => ( | ||
77 | + <option key={item.key} value={item.key}>{ item.value}</option> | ||
78 | + ))} | ||
79 | + <option></option> | ||
80 | + </select> | ||
81 | + <br /> | ||
82 | + <br /> | ||
83 | + <Button>확인</Button> | ||
84 | + | ||
85 | + </Form> | ||
86 | + | ||
7 | </div> | 87 | </div> |
8 | ) | 88 | ) |
9 | -} | 89 | +} |
10 | 90 | ||
11 | export default UploadPage | 91 | export default UploadPage | ... | ... |
1 | body { | 1 | body { |
2 | margin: 0; | 2 | margin: 0; |
3 | - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", | 3 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", |
4 | - "Droid Sans", "Helvetica Neue", sans-serif; | 4 | + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", |
5 | + sans-serif; | ||
5 | -webkit-font-smoothing: antialiased; | 6 | -webkit-font-smoothing: antialiased; |
6 | -moz-osx-font-smoothing: grayscale; | 7 | -moz-osx-font-smoothing: grayscale; |
7 | } | 8 | } |
8 | 9 | ||
9 | code { | 10 | code { |
10 | - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; | 11 | + font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", |
12 | + monospace; | ||
11 | } | 13 | } |
12 | 14 | ||
13 | body { | 15 | body { |
14 | - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", | 16 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, |
15 | - "Segoe UI Emoji", "Segoe UI Symbol"; | 17 | + sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; |
16 | font-size: 14px; | 18 | font-size: 14px; |
17 | line-height: 1.5; | 19 | line-height: 1.5; |
18 | color: #24292e; | 20 | color: #24292e; |
... | @@ -31,7 +33,6 @@ input.error { | ... | @@ -31,7 +33,6 @@ input.error { |
31 | border-color: red; | 33 | border-color: red; |
32 | } | 34 | } |
33 | 35 | ||
34 | - | ||
35 | .input-feedback { | 36 | .input-feedback { |
36 | color: red; | 37 | color: red; |
37 | height: 5px; | 38 | height: 5px; | ... | ... |
-
Please register or login to post a comment