diff --git a/apps/community/src/app/api/mock/board/data.ts b/apps/community/src/app/api/mock/board/data.ts index 9468d13..50dc08c 100644 --- a/apps/community/src/app/api/mock/board/data.ts +++ b/apps/community/src/app/api/mock/board/data.ts @@ -4,7 +4,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 19, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: true, createAt: '2024-11-25', @@ -14,7 +14,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 18, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: true, createAt: '2024-11-24', @@ -24,7 +24,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 20, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: true, createAt: '2024-11-23', @@ -34,7 +34,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 15, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: true, createAt: '2024-11-22', @@ -44,7 +44,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 17, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: true, createAt: '2024-11-21', @@ -54,7 +54,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 22, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: true, createAt: '2024-11-20', @@ -64,7 +64,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 25, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: true, createAt: '2024-11-19', @@ -74,7 +74,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 21, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-18', @@ -84,7 +84,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 19, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-17', @@ -94,7 +94,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 16, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-16', @@ -104,7 +104,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 18, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-15', @@ -114,7 +114,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 14, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-14', @@ -124,7 +124,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 23, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-13', @@ -134,7 +134,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 20, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-12', @@ -144,7 +144,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 22, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-11', @@ -154,7 +154,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 19, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-10', @@ -164,7 +164,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 21, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-09', @@ -174,7 +174,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 26, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-08', @@ -184,7 +184,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 24, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-07', @@ -194,7 +194,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 27, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-06', @@ -204,7 +204,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 23, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-05', @@ -214,7 +214,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 22, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-04', @@ -224,7 +224,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 20, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-03', @@ -234,7 +234,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 18, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-11-02', @@ -244,7 +244,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 19, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-11-01', @@ -254,7 +254,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 17, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-10-31', @@ -264,7 +264,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 21, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-10-30', @@ -274,7 +274,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 20, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-10-29', @@ -284,7 +284,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 22, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: true, isPinned: false, createAt: '2024-10-28', @@ -294,7 +294,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 16, - category: '공지사항', + category: 'DEPT_INFO', hasAttachment: false, isPinned: false, createAt: '2024-10-27', @@ -304,7 +304,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 19, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: true, createAt: '2024-11-25', @@ -314,7 +314,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 18, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: true, createAt: '2024-11-24', @@ -324,7 +324,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 20, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: true, createAt: '2024-11-23', @@ -334,7 +334,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 15, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: true, createAt: '2024-11-22', @@ -344,7 +344,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 17, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: true, createAt: '2024-11-21', @@ -354,7 +354,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 22, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: true, createAt: '2024-11-20', @@ -364,7 +364,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 25, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: true, createAt: '2024-11-19', @@ -374,7 +374,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 21, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-18', @@ -384,7 +384,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 19, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-17', @@ -394,7 +394,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 16, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-16', @@ -404,7 +404,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 18, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-15', @@ -414,7 +414,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 14, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-14', @@ -424,7 +424,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 23, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-13', @@ -434,7 +434,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 20, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-12', @@ -444,7 +444,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 22, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-11', @@ -454,7 +454,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 19, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-10', @@ -464,7 +464,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 21, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-09', @@ -474,7 +474,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 26, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-08', @@ -484,7 +484,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 24, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-07', @@ -494,7 +494,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 27, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-06', @@ -504,7 +504,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 23, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-05', @@ -514,7 +514,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 22, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-04', @@ -524,7 +524,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 20, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-03', @@ -534,7 +534,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 18, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-11-02', @@ -544,7 +544,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 19, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-11-01', @@ -554,7 +554,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 17, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-10-31', @@ -564,7 +564,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 21, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-10-30', @@ -574,7 +574,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 20, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-10-29', @@ -584,7 +584,7 @@ const board = [ title: 'SW 부트캠프 4기 교육생 모집', author: '홈피관리자', views: 22, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: true, isPinned: false, createAt: '2024-10-28', @@ -594,7 +594,7 @@ const board = [ title: '학부 졸업인증 관련 안내', author: '홈피관리자', views: 16, - category: '학부소식', + category: 'DEPT_NEWS', hasAttachment: false, isPinned: false, createAt: '2024-10-27', diff --git a/apps/community/src/app/api/mock/board/route.ts b/apps/community/src/app/api/mock/board/route.ts index be9ee1f..3745349 100644 --- a/apps/community/src/app/api/mock/board/route.ts +++ b/apps/community/src/app/api/mock/board/route.ts @@ -5,8 +5,7 @@ export function GET(request: Request) { const page = Number(url.searchParams.get('page')) || 0; const size = Number(url.searchParams.get('size')) || 10; const keyword = url.searchParams.get('keyword') || ''; - const category = - url.searchParams.get('category')?.toLowerCase().replace(/\s+/g, '') || ''; + const category = url.searchParams.get('category') || ''; const filteredBoards = board.filter((board) => { const matchesKeyword = board.title diff --git a/apps/community/src/app/board/news/page.css.ts b/apps/community/src/app/board/news/page.css.ts new file mode 100644 index 0000000..429a54c --- /dev/null +++ b/apps/community/src/app/board/news/page.css.ts @@ -0,0 +1,11 @@ +import { themeVars } from '@aics-client/design-system/styles'; +import { style } from '@vanilla-extract/css'; + +const boardWrapper = style({ + display: themeVars.display.flex, + flexDirection: themeVars.flexDirection.column, + alignItems: themeVars.alignItems.center, + gap: '2rem', +}); + +export { boardWrapper }; diff --git a/apps/community/src/app/board/news/page.tsx b/apps/community/src/app/board/news/page.tsx new file mode 100644 index 0000000..43b7198 --- /dev/null +++ b/apps/community/src/app/board/news/page.tsx @@ -0,0 +1,46 @@ +import { PageHeader } from '~/components/page-header'; + +import { BoardList } from '~/components/board/board-list'; +import { SearchBar } from '~/components/board/search-bar'; + +import * as styles from '~/app/board/notice/page.css'; +import { Pagination } from '~/components/board/pagination'; +import { getBoards } from '../remote'; + +export const dynamic = 'force-dynamic'; + +export default async function NewsPage(props: { + searchParams?: Promise<{ + category?: string; + page?: string; + keyword?: string; + }>; +}) { + const searchParams = await props.searchParams; + const currentPage = Number(searchParams?.page) || 0; + const keyword = searchParams?.keyword || ''; + + const { data } = await getBoards({ + page: currentPage, + size: 10, + keyword, + category: 'DEPT_NEWS', + }); + + return ( +
+ +
+ + + +
+
+ ); +} diff --git a/apps/community/src/app/board/notice/page.tsx b/apps/community/src/app/board/notice/page.tsx index 2987ee3..0218079 100644 --- a/apps/community/src/app/board/notice/page.tsx +++ b/apps/community/src/app/board/notice/page.tsx @@ -5,11 +5,11 @@ import { SearchBar } from '~/components/board/search-bar'; import * as styles from '~/app/board/notice/page.css'; import { Pagination } from '~/components/board/pagination'; -import { getBoards } from './remote'; +import { getBoards } from '../remote'; export const dynamic = 'force-dynamic'; -export default async function BoardPage(props: { +export default async function NoticePage(props: { searchParams?: Promise<{ category?: string; page?: string; @@ -20,7 +20,12 @@ export default async function BoardPage(props: { const currentPage = Number(searchParams?.page) || 0; const keyword = searchParams?.keyword || ''; - const { data } = await getBoards(currentPage, 10, keyword, '공지사항'); + const { data } = await getBoards({ + page: currentPage, + size: 10, + keyword, + category: 'DEPT_INFO', + }); return (
@@ -33,7 +38,6 @@ export default async function BoardPage(props: {
diff --git a/apps/community/src/app/board/notice/remote.ts b/apps/community/src/app/board/remote.ts similarity index 78% rename from apps/community/src/app/board/notice/remote.ts rename to apps/community/src/app/board/remote.ts index 266e957..d693d46 100644 --- a/apps/community/src/app/board/notice/remote.ts +++ b/apps/community/src/app/board/remote.ts @@ -15,12 +15,14 @@ interface Board { createAt: string; } -async function getBoards( - page: number, - size: number, - keyword: string, - category: string, -) { +interface BoardParams { + page: number; + size: number; + keyword?: string; + category: string; +} + +async function getBoards({ page, size, keyword = '', category }: BoardParams) { const params = new URLSearchParams({ page: page.toString(), size: size.toString(), diff --git a/apps/community/src/components/board/board-list.tsx b/apps/community/src/components/board/board-list.tsx index b5ad734..a8ace91 100644 --- a/apps/community/src/components/board/board-list.tsx +++ b/apps/community/src/components/board/board-list.tsx @@ -4,7 +4,7 @@ import { Eye, Paperclip, Pin } from '@aics-client/design-system/icons'; import { MOCK_END_POINT } from '~/constants/api'; -import type { Board } from '~/app/board/notice/remote'; +import type { Board } from '~/app/board/remote'; import * as styles from '~/components/board/board-list.css'; diff --git a/apps/community/src/components/board/pagination.tsx b/apps/community/src/components/board/pagination.tsx index 6a47e83..18b45c5 100644 --- a/apps/community/src/components/board/pagination.tsx +++ b/apps/community/src/components/board/pagination.tsx @@ -9,11 +9,11 @@ import * as styles from '~/components/board/pagination.css'; interface Props { totalPage: number; // 총 페이지 수 - pageCount: number; // 보여줄 페이지 장 수 currentPage: number; // 현재 페이지 + pageCount?: number; // 보여줄 페이지 장 수 } -function Pagination({ totalPage, pageCount, currentPage }: Props) { +function Pagination({ totalPage, pageCount = 5, currentPage }: Props) { const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams();