From bf0e037c5475a1020c7d658df1d476d760f184b1 Mon Sep 17 00:00:00 2001 From: "Kim, MinGyu" Date: Mon, 11 Jul 2022 16:13:08 +0900 Subject: [PATCH] =?UTF-8?q?css=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20provider=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.tsx | 16 ++++-- frontend/src/commons/layout.tsx | 11 ++++ frontend/src/home/body.tsx | 70 +++++++++++++++-------- frontend/src/home/header.tsx | 81 +++++++++++++-------------- frontend/src/home/theme.tsx | 99 +++++++++++++++++++++++++++------ frontend/src/index.tsx | 6 +- frontend/src/pages/citylist.tsx | 95 +++++++++++++++++++++++++------ src/models/user.model.ts | 2 +- 8 files changed, 271 insertions(+), 109 deletions(-) create mode 100644 frontend/src/commons/layout.tsx diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 44ed392..2c98f37 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -5,16 +5,20 @@ import { Login, Signup } from "./auth"; import { Board } from "./board"; import { Header, Body } from "./home"; import Posting from "./post/posting"; +import Layout from "./commons/layout"; + export const App = () => { return ( - } /> - } /> - }> - } /> - } /> - } /> + }> + } /> + } /> + }> + } /> + } /> + } /> + diff --git a/frontend/src/commons/layout.tsx b/frontend/src/commons/layout.tsx new file mode 100644 index 0000000..29bcf74 --- /dev/null +++ b/frontend/src/commons/layout.tsx @@ -0,0 +1,11 @@ +import React, { ReactNode } from "react"; +import { Outlet } from "react-router-dom"; +import { AuthProvider } from "../auth/auth.context"; + +export default function Layout() { + return ( + + + + ); +} diff --git a/frontend/src/home/body.tsx b/frontend/src/home/body.tsx index 73c68cf..7399ef1 100644 --- a/frontend/src/home/body.tsx +++ b/frontend/src/home/body.tsx @@ -3,7 +3,7 @@ import { Outlet, useSearchParams } from "react-router-dom"; import Theme from "./theme"; import Citylist from "../Pages/citylist"; import { getPicure } from "../Pages/pic"; -import { PaginationLeft ,PaginationRight} from "../Pages/picpagination"; +import { PaginationLeft, PaginationRight } from "../Pages/picpagination"; const initSearchParams = { theme: "", city: "" }; @@ -48,45 +48,66 @@ export default function Body() { ); }); - const pre = () =>{ - setSelected(selected -1) - }; + const pre = () => { + setSelected(selected - 1); + }; - const next = () =>{ - setSelected(selected + 1) - }; + const next = () => { + setSelected(selected + 1); + }; return ( -
+
-
+
- - + +
-
+
-
- - - +
+ + +
- +
// Body Page ); } -{/*
*/} - {/* {Idpics.slice(offset, offset + limit).map((pic, index: number) => ( +{ + /*
*/ +} +{ + /* {Idpics.slice(offset, offset + limit).map((pic, index: number) => (

{pic.name}

- ))} */} - {/* */} - {/* */} \ No newline at end of file + ))} */ +} +{ + /* */ +} +{ + /* */ +} diff --git a/frontend/src/home/header.tsx b/frontend/src/home/header.tsx index 651b2d6..eb5c368 100644 --- a/frontend/src/home/header.tsx +++ b/frontend/src/home/header.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useReducer, useState } from "react"; import { Link, Outlet } from "react-router-dom"; import { useAuth } from "../auth/auth.context"; @@ -8,56 +8,51 @@ export default function Header() { const { logout } = useAuth(); return (
-
- -
-
- {localStorage.getItem("survey-user-info") ? ( - - ) : ( - - )} -
- + +
+ {useAuth().user.isLoggedIn ? ( + -
- -
+ 로그아웃 + + ) : ( + + )}
+
+
); diff --git a/frontend/src/home/theme.tsx b/frontend/src/home/theme.tsx index 13c873e..bb44e7a 100644 --- a/frontend/src/home/theme.tsx +++ b/frontend/src/home/theme.tsx @@ -1,24 +1,89 @@ -import React, { useEffect, MouseEvent, MouseEventHandler } from "react"; -import { Outlet, useSearchParams } from "react-router-dom"; +import React, { MouseEventHandler } from "react"; type ThemeProps = { handleClick: MouseEventHandler; -} +}; -export default function Theme({handleClick}: ThemeProps) { +export default function Theme({ handleClick }: ThemeProps) { return ( -
- - - - - - - - - - - +
+ + + + + + + + + + +
); -}; \ No newline at end of file +} diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index ff73a6d..c299b67 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -8,8 +8,8 @@ const root = createRoot(container!); root.render( - - - + {/* */} + + {/* */} ); diff --git a/frontend/src/pages/citylist.tsx b/frontend/src/pages/citylist.tsx index 911d03a..4e29e1b 100644 --- a/frontend/src/pages/citylist.tsx +++ b/frontend/src/pages/citylist.tsx @@ -1,24 +1,85 @@ -import React, { MouseEventHandler } from "react"; - +import React, { MouseEventHandler } from "react"; type CityProps = { handleClick: MouseEventHandler; -} +}; -export default function Citylist({handleClick}: CityProps) { +export default function Citylist({ handleClick }: CityProps) { return ( -
- - - - - - - - - - +
+
도시
+ + + + + + + + + + {/* citylist */} -
// Citylist Page +
+ // Citylist Page ); -}; \ No newline at end of file +} diff --git a/src/models/user.model.ts b/src/models/user.model.ts index 5fe10cd..84cde5b 100644 --- a/src/models/user.model.ts +++ b/src/models/user.model.ts @@ -17,7 +17,7 @@ const schema = new Schema( email: { type: String, //mongoose type인 String으로 일반적인 string과는 겉으로는 대문자 차이 rquired: true, - .: true, + unique: true, validate: [validateEmail, "이메일을 입력해주세요"], }, name: { type: String }, -- GitLab