From ab76f24e28a1d733b9648accf0891decd749c61a Mon Sep 17 00:00:00 2001 From: "Kim, MinGyu" Date: Wed, 27 Jul 2022 14:30:04 +0900 Subject: [PATCH] =?UTF-8?q?css=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/auth/signup.tsx | 24 ++-- frontend/src/board/board.tsx | 33 +++-- frontend/src/home/body.tsx | 8 +- frontend/src/home/header.tsx | 8 +- frontend/src/home/theme.tsx | 189 ++++++++++++++----------- frontend/src/pages/citylist.tsx | 172 ++++++++++++---------- frontend/src/types/index.tsx | 3 +- src/controllers/fileinfo.controller.ts | 12 +- src/db/index.ts | 2 +- 9 files changed, 265 insertions(+), 186 deletions(-) diff --git a/frontend/src/auth/signup.tsx b/frontend/src/auth/signup.tsx index c08d190..5707348 100644 --- a/frontend/src/auth/signup.tsx +++ b/frontend/src/auth/signup.tsx @@ -77,12 +77,12 @@ export default function Signup() {
-
+
이름
-
+
-
+
이메일
-
+
-
+
비밀번호
-
+
-
+
비밀번호 확인
-
+
(); + const navigate = useNavigate(); + const { user } = useAuth(); useEffect(() => { getDataList(); @@ -36,29 +39,37 @@ export default function BoardPage() { } }; + const goLogin = async (event: React.MouseEvent) => { + if (!user.isLoggedIn) { + alert("로그인이 필요합니다."); + navigate("/login", { replace: true }); + } + }; + return (
-
자유 게시판
-
여행지 후기를 남겨주세요!
+
자유 게시판
+
+ 여행지 후기를 남겨주세요! +
-
- - - -
{" "} - {/* Link */} +
+ +
-
+
제목
게시 날짜
조회수
-
+
{posts?.map((post, i) => ( ))} diff --git a/frontend/src/home/body.tsx b/frontend/src/home/body.tsx index a3be100..4ae59e2 100644 --- a/frontend/src/home/body.tsx +++ b/frontend/src/home/body.tsx @@ -21,10 +21,10 @@ export default function Body() { imgsData(); }, []); - useEffect(() => { - console.log(searchParams.get("theme"), searchParams.get("city")); - setSearchParams(searchParams); - }, []); + // useEffect(() => { + // console.log(searchParams.get("theme"), searchParams.get("city")); + // setSearchParams(searchParams); + // }, []); const themeHandleClick = (event: MouseEvent) => { console.log(`theme id= ${event.currentTarget.id}`); diff --git a/frontend/src/home/header.tsx b/frontend/src/home/header.tsx index ff3c9c0..f0be7f9 100644 --- a/frontend/src/home/header.tsx +++ b/frontend/src/home/header.tsx @@ -14,20 +14,20 @@ export default function Header() { }; return ( -
+
-
-
diff --git a/frontend/src/home/theme.tsx b/frontend/src/home/theme.tsx index 1b70b00..058ed39 100644 --- a/frontend/src/home/theme.tsx +++ b/frontend/src/home/theme.tsx @@ -1,89 +1,120 @@ -import React, { MouseEventHandler } from "react"; +import React, { MouseEventHandler, useState } from "react"; type ThemeProps = { handleClick: MouseEventHandler; }; export default function Theme({ handleClick }: ThemeProps) { + const [active, setActive] = useState(0); + + const onactive = "whitespace-nowrap px-5 text-sky-300 "; + const offactive = "whitespace-nowrap px-5 "; + + const clickActive = (a: number) => { + setActive(a); + }; + return ( -
- - - - - - - - - - - +
+
clickActive(1)}> + +
+
clickActive(2)}> + +
+
clickActive(3)}> + +
+
clickActive(4)}> + +
+
clickActive(5)}> + +
+
clickActive(6)}> + +
+
clickActive(7)}> + +
+
clickActive(8)}> + +
+
clickActive(9)}> + +
+
clickActive(10)}> + +
+
clickActive(11)}> + +
); } diff --git a/frontend/src/pages/citylist.tsx b/frontend/src/pages/citylist.tsx index a6fa3de..7f498db 100644 --- a/frontend/src/pages/citylist.tsx +++ b/frontend/src/pages/citylist.tsx @@ -1,86 +1,114 @@ -import React, { MouseEventHandler } from "react"; +import React, { MouseEventHandler, useState } from "react"; type CityProps = { handleClick: MouseEventHandler; }; export default function Citylist({ handleClick }: CityProps) { + const [active, setActive] = useState(0); + + const onactive = "text-start px-5 py-2 underline whitespace-nowrap"; + const offactive = "text-start px-5 py-2 whitespace-nowrap"; + + const clickActive = (a: number) => { + setActive(a); + }; + return (
도시
- - - - - - - - - - - {/* citylist */} +
clickActive(1)}> + +
+
clickActive(2)}> + +
+
clickActive(3)}> + +
+
clickActive(4)}> + +
+
clickActive(5)}> + +
+
clickActive(6)}> + +
+
clickActive(7)}> + +
+
clickActive(8)}> + +
+
clickActive(9)}> + +
+
clickActive(10)}> + +
// Citylist Page ); diff --git a/frontend/src/types/index.tsx b/frontend/src/types/index.tsx index a4617ba..48ee863 100644 --- a/frontend/src/types/index.tsx +++ b/frontend/src/types/index.tsx @@ -39,7 +39,8 @@ export interface SignupUser { export interface Profile { _id: string; email: string; - fileInfo: { + name: string; + avatar: { originalfilename: string; newfilename: string; picturepath: string; diff --git a/src/controllers/fileinfo.controller.ts b/src/controllers/fileinfo.controller.ts index a3d1c43..330b21c 100644 --- a/src/controllers/fileinfo.controller.ts +++ b/src/controllers/fileinfo.controller.ts @@ -4,7 +4,11 @@ import { TypedRequest } from "../types"; export const uploadFile = asyncWrap(async (reqExp, res, next) => { const req = reqExp as TypedRequest; - const form = formidable({ multiples: false, uploadDir: "uploads" }); + const form = formidable({ + multiples: false, + uploadDir: "uploads", + keepExtensions: true, + }); await new Promise((resolve, reject) => { form.parse(req, (err, fields, files) => { @@ -25,7 +29,11 @@ export const uploadFile = asyncWrap(async (reqExp, res, next) => { export const uploadFiles = asyncWrap(async (reqExp, res, next) => { const req = reqExp as TypedRequest; - const form = formidable({ multiples: true, uploadDir: "uploads" }); + const form = formidable({ + multiples: true, + uploadDir: "uploads", + keepExtensions: true, + }); await new Promise((resolve, reject) => { form.parse(req, (err, fields, files) => { diff --git a/src/db/index.ts b/src/db/index.ts index b714af5..b4f157f 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,4 +1,4 @@ export * as roleDb from "./role.db"; export * as postDb from "./post.db"; export * as userDb from "./user.db"; -export * as mainimgDb from "./mainimg.db" \ No newline at end of file +export * as mainimgDb from "./mainimg.db"; -- GitLab