-
Notifications
You must be signed in to change notification settings - Fork 1
일반 게시글 상세페이지 목업 연동 및 컴포넌트 구조 분리 #292
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bba150a
feat(list-detail): 상세페이지 임시 커밋
wlrnjs 3d6592f
refactor(list-detail): 상세페이지 컴포넌트 분리
wlrnjs d8a26be
refactor(list-detail): 사용하지 않는 div 제거 및 구조 수정
wlrnjs 0fb32eb
feat(list-detail): Chip 영역 분리 및 추가
wlrnjs 74ba1bc
feat(list-detail): 상세페이지 타입 추가
wlrnjs 8d2a4de
test(list-detail): 테스트 코드 수정 및 주석 추가
wlrnjs 7f06c3c
Merge branch 'develop' into feat/detail-page-api
wlrnjs 54f9848
chore(list-detail): 빌드에러 수정
wlrnjs f7273d5
Merge branch 'develop' into feat/detail-page-api
wlrnjs cdedfde
Merge branch 'develop' of https://github.com/find-my-item/FMI-FE into…
wlrnjs fe48e50
refactor(list-detail): 상세페이지 타입 수정
wlrnjs 8f1d25e
Merge branch 'feat/detail-page-api' of https://github.com/find-my-ite…
wlrnjs 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export * from "./types/PostItemType"; | ||
| export * from "./types/PostDetailType"; | ||
|
|
||
| export { useGetPost } from "./api/useGetPost"; |
This file contains hidden or 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,25 @@ | ||
| import { CategoryType } from "@/types"; | ||
| import { ItemStatus, PostType } from "./PostItemType"; | ||
|
|
||
| export interface GetPostDetailResponse { | ||
| isSuccess: boolean; | ||
| code: string; | ||
| message: string; | ||
| result: PostDetail; | ||
| } | ||
|
|
||
| export interface PostDetail { | ||
| postId: number; | ||
| title: string; | ||
| content: string; | ||
| address: string; | ||
| latitude: number; | ||
| longitude: number; | ||
| postType: PostType; | ||
| itemStatus: ItemStatus; | ||
| imageUrls: Array<string>; | ||
| radius: number; | ||
| category: CategoryType; | ||
| favoriteCount: number; | ||
| favoriteStatus: boolean; | ||
| } |
This file contains hidden or 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,6 @@ | ||
| export const LABELS = { | ||
| find: { label: "습득", backPath: "/find" }, | ||
| lost: { label: "분실", backPath: "/lost" }, | ||
| notice: { label: "공지사항", backPath: "/notice?tab=notice" }, | ||
| customer: { label: "문의내역", backPath: "/notice?tab=customer" }, | ||
| } as const; |
This file contains hidden or 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 hidden or 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
20 changes: 20 additions & 0 deletions
20
...pp/(route)/list/[id]/_components/PostDetail/_internal/PostChipSection/PostChipSection.tsx
This file contains hidden or 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,20 @@ | ||
| import { Chip } from "@/components"; | ||
| import { CategoryType } from "@/types"; | ||
| import { ItemStatus } from "@/api/fetch/post"; | ||
| import { getItemCategoryLabel, getItemStatusLabel } from "@/utils"; | ||
|
|
||
| type ChipData = { | ||
| itemStatus: ItemStatus; | ||
| category: CategoryType; | ||
| }; | ||
|
|
||
| const PostChipSection = ({ itemStatus, category }: ChipData) => { | ||
| return ( | ||
| <div className="flex gap-2"> | ||
| <Chip type="status" label={getItemStatusLabel(itemStatus)} /> | ||
| <Chip type="category" label={getItemCategoryLabel(category)} /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default PostChipSection; | ||
57 changes: 57 additions & 0 deletions
57
src/app/(route)/list/[id]/_components/PostDetail/_internal/PostDetailBody/PostDetailBody.tsx
This file contains hidden or 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,57 @@ | ||
| import { formatNumber } from "@/utils"; | ||
| import { CategoryType } from "@/types"; | ||
| import { Chip, Icon } from "@/components"; | ||
| import { ItemStatus } from "@/api/fetch/post"; | ||
| import { NoticeChip } from "@/app/(route)/notice/_components"; | ||
| import PostChipSection from "../PostChipSection/PostChipSection"; | ||
| import { LABELS } from "../../LABELS"; | ||
|
|
||
| type BodyData = { | ||
| title: string; | ||
| content: string; | ||
| favoriteCount: number; | ||
| itemStatus: ItemStatus; | ||
| category: CategoryType; | ||
| }; | ||
|
|
||
| type PostDetailBodyProps = { | ||
| isBoardType: boolean; | ||
| label: "find" | "lost" | "notice" | "customer"; | ||
| data: BodyData; | ||
| }; | ||
|
|
||
| const PostDetailBody = ({ isBoardType, label, data }: PostDetailBodyProps) => { | ||
| const { title, content, favoriteCount, itemStatus, category } = data; | ||
|
|
||
| return ( | ||
| <article> | ||
| {isBoardType ? ( | ||
| <PostChipSection itemStatus={itemStatus} category={category} /> | ||
| ) : ( | ||
| <NoticeChip label={LABELS[label].label} /> | ||
| )} | ||
|
|
||
| <div className={isBoardType ? "mt-[14px]" : "space-y-[28px]"}> | ||
| <div> | ||
| <h1 className="text-[20px] font-semibold text-layout-header-default">{title}</h1> | ||
| <time className="text-[14px] leading-[140%] text-layout-body-default">30분 전</time> | ||
| </div> | ||
|
|
||
| <p className="mt-[24px] text-body1-regular text-layout-header-default">{content}</p> | ||
|
|
||
| <ul className="mt-[32px] flex gap-[20px] text-body2-medium text-layout-body-default"> | ||
| <li className="flex gap-[4px]"> | ||
| <Icon name="Star" size={20} /> | ||
| <span>즐겨찾기 {formatNumber(favoriteCount)}</span> | ||
| </li> | ||
| <li className="flex gap-[4px]"> | ||
| <Icon name="EyeOpen" size={20} /> | ||
| <span>조회 {formatNumber(24)}</span> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| </article> | ||
| ); | ||
| }; | ||
|
|
||
| export default PostDetailBody; |
40 changes: 40 additions & 0 deletions
40
src/app/(route)/list/[id]/_components/PostDetail/_internal/PostDetailMap/PostDetailMap.tsx
This file contains hidden or 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,40 @@ | ||
| import { Icon } from "@/components"; | ||
|
|
||
| type MapData = { | ||
| address: string; | ||
| latitude: string; | ||
| longitude: string; | ||
| }; | ||
|
|
||
| interface PostDetailMapProps { | ||
| data: MapData; | ||
| } | ||
|
|
||
| const PostDetailMap = ({ data }: PostDetailMapProps) => { | ||
| const { address, latitude, longitude } = data; | ||
|
|
||
| return ( | ||
| <div className="flex flex-col gap-[18px]"> | ||
| {/* TODO(지권): 추후 지도 컴포넌트 변경 */} | ||
| <div className="h-[147px] rounded-md bg-black" /> | ||
| <address className="flex items-center gap-[6px] not-italic"> | ||
| <span className="flex items-center gap-[5px]"> | ||
| {address && ( | ||
| <Icon | ||
| name="Position" | ||
| size={16} | ||
| aria-hidden="true" | ||
| className="fill-current text-brand-subtle-default" | ||
| /> | ||
| )} | ||
| <p className="text-[14px] text-neutral-normal-default"> | ||
| {address || "위치 정보가 없어요"} | ||
| </p> | ||
| </span> | ||
| {address && <Icon name="ArrowRight" size={14} />} | ||
| </address> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default PostDetailMap; |
2 changes: 2 additions & 0 deletions
2
src/app/(route)/list/[id]/_components/PostDetail/_internal/index.ts
This file contains hidden or 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,2 @@ | ||
| export { default as PostDetailBody } from "./PostDetailBody/PostDetailBody"; | ||
| export { default as PostDetailMap } from "./PostDetailMap/PostDetailMap"; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.