From ba21ad81b89d37e9f89bf6852f4555bbdb718591 Mon Sep 17 00:00:00 2001 From: seoinah Date: Fri, 28 Mar 2025 20:39:36 +0900 Subject: [PATCH 1/3] feat: add not found page --- src/App.tsx | 22 +++++++++++++++------- src/pages/404.tsx | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 src/pages/404.tsx diff --git a/src/App.tsx b/src/App.tsx index b865557..f96b6ba 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,6 +8,8 @@ import { import { QueryClient, QueryClientProvider } from "react-query"; import Layout from "@/components/Layout/Layout.tsx"; import { IRoute, Pages } from "@/types/route.ts"; +import NotFound from "@/pages/404"; + const pages: Pages = import.meta.glob("./pages/**/*.tsx", { eager: true }); const routes: IRoute[] = []; @@ -41,13 +43,19 @@ const router = createBrowserRouter([ { path: "/", // Layout의 루트 경로 element: , - children: routes.map(({ Element, ErrorBoundary, ...rest }) => ({ - ...rest, - element: , - ...(ErrorBoundary && { - errorElement: React.createElement(ErrorBoundary), - }), - })), + children: [ + ...routes.map(({ Element, ErrorBoundary, ...rest }) => ({ + ...rest, + element: , + ...(ErrorBoundary && { + errorElement: React.createElement(ErrorBoundary), + }), + })), + { + path: "*", + element: , + }, + ], }, ]); diff --git a/src/pages/404.tsx b/src/pages/404.tsx new file mode 100644 index 0000000..d865a53 --- /dev/null +++ b/src/pages/404.tsx @@ -0,0 +1,25 @@ +import { useNavigate } from "react-router-dom"; + +const NotFound = () => { + const navigate = useNavigate(); + + return ( +
+
+

404

+

페이지를 찾을 수 없습니다

+

+ 요청하신 페이지가 삭제되었거나 잘못된 경로입니다. +

+
+ +
+ ); +}; + +export default NotFound; \ No newline at end of file From b56375324ad82d7302b18a7add924042f6e66203 Mon Sep 17 00:00:00 2001 From: seoinah Date: Fri, 28 Mar 2025 20:57:10 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EA=B3=B5=EC=A7=80=EC=82=AC=ED=95=AD?= =?UTF-8?q?=20=EA=B3=A0=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AboutTable/AboutTable.tsx | 45 +++++++++++++++++++----- src/pages/board/notice/index.tsx | 11 ++++-- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/components/AboutTable/AboutTable.tsx b/src/components/AboutTable/AboutTable.tsx index 4c3e359..5232c3b 100644 --- a/src/components/AboutTable/AboutTable.tsx +++ b/src/components/AboutTable/AboutTable.tsx @@ -1,27 +1,38 @@ import { useNavigate } from "react-router-dom"; +import { FaThumbtack } from "react-icons/fa"; interface Column { label: string; value: string; + size: string; } -interface AboutTableProps { +interface AboutTableProps { columns: Column[]; data: T[]; + moveToDetail: (row: T) => void; } -export const AboutTable = ({ +export const AboutTable = ({ columns, data, + moveToDetail, }: AboutTableProps) => { - const nav = useNavigate(); - const moveToDetail = (row: T) => { - nav(`/board/notice/${row.id}`); - }; + + // 고정된 항목과 일반 항목을 분리 + const pinnedItems = data.filter((item: any) => item.is_pinned); + const normalItems = data.filter((item: any) => !item.is_pinned); + return (
+ + {columns.map((column, index) => ( + + ))} + + {columns.map((column, index) => ( @@ -35,9 +46,27 @@ export const AboutTable = ({ - {data.map((row, rowIndex) => ( + {/* 고정된 항목 먼저 표시 */} + {pinnedItems.map((row, rowIndex) => ( + moveToDetail(row)} + > + {columns.map((column, index) => ( + + ))} + + ))} + {/* 일반 항목 표시 */} + {normalItems.map((row, rowIndex) => ( moveToDetail(row)} > diff --git a/src/pages/board/notice/index.tsx b/src/pages/board/notice/index.tsx index 705ef0e..b3625aa 100644 --- a/src/pages/board/notice/index.tsx +++ b/src/pages/board/notice/index.tsx @@ -12,9 +12,10 @@ import { Container } from "@/components/Container"; import { useState } from "react"; const tableColumns = [ - { label: "번호", value: "id" }, + { label: "번호", value: "id", size:"10%"}, /* { label: "태그", value: "tag" },*/ - { label: "제목", value: "title" }, + { label: "제목", value: "title", size:"80%"}, + { label: "고정", value: "pin", size:"10%"}, /*{ label: "작성일", value: "date" },*/ ]; @@ -42,6 +43,10 @@ export const Notice: React.FC = () => { setPage(val); }; + const moveToDetail = (row: any) => { + nav(`/board/notice/${row.id}`); + }; + return ( <>
@@ -71,7 +76,7 @@ export const Notice: React.FC = () => { onTabChange={tabMockData.onTabChange} /> {/* REVIEW: "총 N개의 공지가 있습니다" 레이블 어떻게 표시할 건지? */} - + {/* XXX: AboutTable 테이블 높이가 고정되어 있어서 Pagination 위치가 부자연스러움 */} {noticeList && noticeList.length > 0 && ( Date: Fri, 28 Mar 2025 21:47:14 +0900 Subject: [PATCH 3/3] feat: add coc page --- src/components/Header/Header.tsx | 23 +- src/pages/coc/index.tsx | 740 +++++++++++++++++++++++++++++++ 2 files changed, 756 insertions(+), 7 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index f317210..65e4cda 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -26,6 +26,11 @@ const menuItems = [ { label: "MD", path: "/about/md" }, ], }, + { + label: "COC", + hasDropdown: false, + path: "/coc", + }, /* { label: "NEWS", hasDropdown: false }, { label: "SUPPORT", hasDropdown: false }, { label: "COC", hasDropdown: false },*/ @@ -63,13 +68,17 @@ const Header = ({ backgroundColor, textColor }: HeaderProps) => { {/* 데스크탑 네비게이션 */}
+ {column.value === "pin" ? : String(row[column.value as keyof T] ?? "-")} +