-
Notifications
You must be signed in to change notification settings - Fork 6
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
Notice 페이지 API 연동 및 컴포넌트 교체 #284
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
563eeb4
Fix: 공지 폴더명 notices에서 notice로 수정
Nahyun-Kang 4f9d06a
Feat: 모든 게시물 조회 API 연동
Nahyun-Kang af6cec8
Fix: 게시판 헤더 추가
Nahyun-Kang 613eb86
Feat: 게시물 API 연동 및 컴포넌트 교체
Nahyun-Kang ab93be1
Merge branch 'dev' into Feat/notice
Nahyun-Kang 50bd316
Fix: 코드리뷰 반영
Nahyun-Kang 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.
201 changes: 102 additions & 99 deletions
201
public/workbox-c95f9b89.js → public/workbox-1bb06f5e.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
import { NoticeListItemType } from '@/lib/types/noticeType'; | ||
|
||
const getNotices = async () => { | ||
const result = await axiosInstance.get<NoticeListItemType[]>('/notices'); | ||
|
||
return result.data; | ||
}; | ||
|
||
export default getNotices; |
File renamed without changes.
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
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,64 @@ | ||
'use client'; | ||
|
||
import Link from 'next/link'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
import getNoticeDetail from '@/app/_api/notice/getNoticeDetail'; | ||
import { QUERY_KEYS } from '@/lib/constants/queryKeys'; | ||
import { NoticeDetailType } from '@/lib/types/noticeType'; | ||
|
||
import * as styles from './NoticeDetail.css'; | ||
import NoticeDetailInfo from '@/components/NoticeDetail/NoticeDetailInfo'; | ||
|
||
function NoticeDetailComponent({ params }: { params: { noticeId: string } }) { | ||
const noticeId = params.noticeId; | ||
const noticeIdNumber = noticeId ? Number(noticeId) : null; | ||
const router = useRouter(); | ||
|
||
const { data: notice } = useQuery<NoticeDetailType>({ | ||
queryKey: [QUERY_KEYS.getNoticeDetail, noticeIdNumber], | ||
queryFn: () => getNoticeDetail(noticeIdNumber as number), | ||
enabled: noticeIdNumber !== null, // noticeIdNumber가 유효한 경우에만 실행 | ||
}); | ||
|
||
if (!notice) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<div className={styles.header}> | ||
<span className={styles.back} onClick={() => router.back()}> | ||
뒤로가기 | ||
</span> | ||
</div> | ||
<NoticeDetailInfo noticeData={notice} /> | ||
<section className={styles.signPostWrapper}> | ||
{notice?.prevNotice && ( | ||
<Link href={`/notice/${notice?.prevNotice.id}`}> | ||
<div className={styles.listItemWrapper}> | ||
<div className={styles.sign}>이전글</div> | ||
<div className={styles.noticeTitle}>{notice?.prevNotice?.title}</div> | ||
<p className={styles.noticeDescription}>{notice?.prevNotice?.description}</p> | ||
</div> | ||
</Link> | ||
)} | ||
{notice?.nextNotice && ( | ||
<Link href={`/notice/${notice?.nextNotice.id}`}> | ||
<div className={styles.listItemWrapper}> | ||
<div className={styles.sign}>다음글</div> | ||
<div className={styles.noticeTitle}>{notice?.nextNotice?.title}</div> | ||
<p className={styles.noticeDescription}>{notice?.nextNotice?.description}</p> | ||
</div> | ||
</Link> | ||
)} | ||
<Link href={'/notice'}> | ||
<button className={styles.link}>목록보기</button> | ||
</Link> | ||
</section> | ||
</> | ||
); | ||
} | ||
|
||
export default NoticeDetailComponent; |
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,17 @@ | ||
import NoticeDetailComponent from './NoticeDetail'; | ||
|
||
interface NoticeDetailPageProps { | ||
params: { | ||
noticeId: string; // Next.js에서 params는 기본적으로 string 타입으로 전달됩니다. | ||
}; | ||
} | ||
|
||
function NoticeDetailPage({ params }: NoticeDetailPageProps) { | ||
return ( | ||
<section> | ||
<NoticeDetailComponent params={params} /> | ||
</section> | ||
); | ||
} | ||
|
||
export default NoticeDetailPage; |
File renamed without changes.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
한가지 궁금한점이 NoticeListItemType 타입은 itemImageUrl 필드를 가지고 있는데, 해당 필드는 게시물을 생성할 때 콘텐츠블록에 이미지 블록을 의미하는 것이 맞을까요? 아니면 대표 이미지가 있는 것인지 해당 이미지가 UI상 노출되는 부분을 확인할 수 없어서 여쭤봅니다~!