-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(community): 학부소식 페이지 추가 #39
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<section> | ||
<PageHeader | ||
title="학부소식" | ||
description="기사, 활동 및 수상 소식 등을 소개해요." | ||
/> | ||
<section className={styles.boardWrapper}> | ||
<SearchBar placeholder="검색어를 입력하세요" /> | ||
<BoardList data={data.contents} /> | ||
<Pagination | ||
totalPage={data.pagable.totalPage} | ||
currentPage={currentPage} | ||
/> | ||
</section> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
|
||||||
async function getBoards({ page, size, keyword = '', category }: BoardParams) { | ||||||
const params = new URLSearchParams({ | ||||||
page: page.toString(), | ||||||
size: size.toString(), | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 타입을 따로 분리해주는건 어떨까요 ?
공지사항 페이지에도 공통으로 사용되는 부분으로 보여요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공통적으로 사용하지만 성급한 추상화가 될 수 있다고 생각해요. 나중에 요구사항이 변경되어 공지사항과 학부소식이 동일하지 않는 파라미터로 사용할 수도 있는 가능성도 생각하여, 지금 처럼 복잡하지 않는 상태를 추상화하지 않고 두는 것도 괜찮다고 생각해요. 한 번 추상화나 레이어가 생긴다면 의존성과 커플링이 생겨버리니까요. 다른 분들 의견이 궁금합니다
@kgu-developers/1-client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 파라미터 변경 가능성이 있다고 생각하여 추상화하지 않았습니다!