-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 스토리 조회 구현 (#85) #106
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
11 commits
Select commit
Hold shift + click to select a range
b3d4ba9
chore(#85): framer motion -> motion으로 변경
wkdtnqls0506 45330a4
chore(#85): 아이콘 피그마 네이밍에 맞게 수정
wkdtnqls0506 0dcddaf
feat(#85): memberId 기반 프로필 색상 할당 유틸 및 색상 상수 생성
wkdtnqls0506 479cfb3
feat(#85): Avatar 컴포넌트 생성
wkdtnqls0506 5baa1da
feat(#85): 스토리 상세 정보 조회 API 및 타입 생성
wkdtnqls0506 414c3ab
feat(#85): 스토리 상세 페이지 및 컴포넌트 생성
wkdtnqls0506 615fedc
feat(#85): 아이콘 생성
wkdtnqls0506 05b6fca
chore(#85): 외부 링크 보안 속성 추가
wkdtnqls0506 04fbeb6
chore(#85): await 중복 키워드 제거
wkdtnqls0506 c379a7c
chore(#85): 가게 검색 API에 http 클라이언트 적용
wkdtnqls0506 85800ae
chore(#85): market icon 네이밍 변경
wkdtnqls0506 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/app/(search)/_components/SearchStoreBottomSheet/SearchStoreBottomSheet.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
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,13 @@ | ||
| import { style } from "@vanilla-extract/css"; | ||
|
|
||
| import { radius } from "@/styles"; | ||
|
|
||
| export const avatar = style({ | ||
| width: "3.4rem", | ||
| height: "3.4rem", | ||
| display: "flex", | ||
| alignItems: "center", | ||
| justifyContent: "center", | ||
| padding: "0.6rem", | ||
| borderRadius: radius.circle, | ||
| }); |
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,41 @@ | ||
| import Bapurit from "@/assets/logo/symbol.svg"; | ||
|
|
||
| import { PROFILE_COLORS } from "../../_constants"; | ||
| import { getProfileColorIndex } from "../../_utils"; | ||
| import * as styles from "./Avatar.css"; | ||
|
|
||
| type AvatarProps = { | ||
| /** 사용자 고유 ID */ | ||
| memberId: number; | ||
|
|
||
| className?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * 사용자별 고유한 색상 배경을 가진 프로필 아바타 컴포넌트 | ||
| * | ||
| * @description | ||
| * memberId를 기반으로 3가지 색상(노랑, 분홍, 파랑) 중 하나를 자동으로 할당합니다. | ||
| * 같은 memberId는 항상 같은 색상을 가집니다. | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * <Avatar memberId={123} /> | ||
| * <Avatar memberId={story.memberId} /> | ||
| * ``` | ||
| */ | ||
| export const Avatar = ({ memberId, className }: AvatarProps) => { | ||
| const colorIndex = getProfileColorIndex(memberId); | ||
| const colorConfig = PROFILE_COLORS[colorIndex]; | ||
|
|
||
| return ( | ||
| <div | ||
| className={`${styles.avatar} ${className || ""}`} | ||
| style={{ | ||
| backgroundColor: colorConfig.background, | ||
| }} | ||
| > | ||
| <Bapurit width={23} height={23} /> | ||
| </div> | ||
| ); | ||
| }; |
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 @@ | ||
| export { Avatar } from "./Avatar"; |
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 @@ | ||
| export * from "./profileColors.constants"; |
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,19 @@ | ||
| export const PROFILE_COLORS = { | ||
| 0: { | ||
| background: "#FFF1AF", | ||
| name: "yellow", | ||
| }, | ||
| 1: { | ||
| background: "#FFDDDA", | ||
| name: "pink", | ||
| }, | ||
| 2: { | ||
| background: "#C9ECFF", | ||
| name: "blue", | ||
| }, | ||
| } as const; | ||
|
|
||
| export type ProfileColorIndex = keyof typeof PROFILE_COLORS; | ||
|
|
||
| // 프로필 색상의 개수 | ||
| export const PROFILE_COLOR_COUNT = Object.keys(PROFILE_COLORS).length; |
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 +1,2 @@ | ||
| export { phoneNumberUtils } from "./phoneNumberUtils"; | ||
| export * from "./phoneNumberUtils"; | ||
| export * from "./profileUtils"; |
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,12 @@ | ||
| import { | ||
| PROFILE_COLOR_COUNT, | ||
| type ProfileColorIndex, | ||
| } from "../_constants/profileColors.constants"; | ||
|
|
||
| /** | ||
| * memberId를 기반으로 프로필 색상 인덱스 반환 (0, 1, 2) | ||
| * memberId를 색상 개수로 나눈 나머지 사용 | ||
| */ | ||
| export const getProfileColorIndex = (memberId: number): ProfileColorIndex => { | ||
| return (Math.abs(memberId) % PROFILE_COLOR_COUNT) as ProfileColorIndex; | ||
| }; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { http } from "@/lib/api"; | ||
|
|
||
| import { type StoryDetailResponse } from "./detail.types"; | ||
|
|
||
| /** | ||
| * 스토리 상세 정보 조회 API | ||
| * @param storyId - 조회할 스토리 ID | ||
| * @returns {Promise<StoryDetailResponse>} 스토리 상세 정보 | ||
| */ | ||
| export const getStoryDetail = async ( | ||
| storyId: string | ||
| ): Promise<StoryDetailResponse> => { | ||
| return await await http | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .get(`api/stories/${storyId}`) | ||
| .json<StoryDetailResponse>(); | ||
| }; | ||
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,12 @@ | ||
| import { getStoryDetail } from "./detail.api"; | ||
|
|
||
| export const storyDetailQueryKeys = { | ||
| all: ["story", "detail"] as const, | ||
| detail: (id: string) => [...storyDetailQueryKeys.all, id] as const, | ||
| } as const; | ||
|
|
||
| export const storyDetailQueryOptions = (storyId: string) => ({ | ||
| queryKey: storyDetailQueryKeys.detail(storyId), | ||
| queryFn: () => getStoryDetail(storyId), | ||
| enabled: !!storyId, | ||
| }); |
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,11 @@ | ||
| export type StoryDetailResponse = { | ||
| storeKakaoId: string; | ||
| category: string; | ||
| storeName: string; | ||
| storeDistrict: string; | ||
| storeNeighborhood: string; | ||
| description: string | null; | ||
| imageUrl: string; | ||
| memberId: number; | ||
| memberNickname: string; | ||
| }; |
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,3 @@ | ||
| export * from "./detail.api"; | ||
| export * from "./detail.queries"; | ||
| export * from "./detail.types"; |
121 changes: 121 additions & 0 deletions
121
src/app/story/[id]/_components/StoryDetailContent/StoryDetailContent.css.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,121 @@ | ||
| import { style } from "@vanilla-extract/css"; | ||
|
|
||
| import { radius, semantic } from "@/styles"; | ||
|
|
||
| export const container = style({ | ||
| position: "relative", | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| width: "100%", | ||
| height: "100dvh", | ||
| backgroundColor: semantic.dark.normal, | ||
| }); | ||
|
|
||
| export const gnbOverlay = style({ | ||
| position: "absolute", | ||
| top: 0, | ||
| left: 0, | ||
| right: 0, | ||
| }); | ||
|
|
||
| export const cancelIconWrapper = style({ | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| }); | ||
|
|
||
| export const cancelIcon = style({ | ||
| width: "2.4rem", | ||
| height: "2.4rem", | ||
| color: semantic.icon.white, | ||
| }); | ||
|
|
||
| export const imageCard = style({ | ||
| position: "relative", | ||
| width: "100%", | ||
| height: "100%", | ||
| flex: 1, | ||
| overflow: "hidden", | ||
| }); | ||
|
|
||
| export const image = style({ | ||
| objectFit: "contain", | ||
| }); | ||
|
|
||
| export const imageContent = style({ | ||
| position: "absolute", | ||
| bottom: 0, | ||
| left: 0, | ||
| right: 0, | ||
| padding: "0 2rem 2rem", | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: "1.2rem", | ||
| zIndex: 10, | ||
| }); | ||
|
|
||
| export const userWrapper = style({ | ||
| width: "100%", | ||
| display: "flex", | ||
| alignItems: "center", | ||
| gap: "1.2rem", | ||
| }); | ||
|
|
||
| export const descriptionContainer = style({ | ||
| width: "100%", | ||
| position: "relative", | ||
| }); | ||
|
|
||
| export const tagContainer = style({ | ||
| display: "flex", | ||
| alignItems: "center", | ||
| gap: "0.8rem", | ||
| }); | ||
|
|
||
| export const descriptionText = style({ | ||
| cursor: "pointer", | ||
| wordBreak: "keep-all", | ||
| wordWrap: "break-word", | ||
| }); | ||
|
|
||
| export const collapsed = style({ | ||
| display: "-webkit-box", | ||
| WebkitLineClamp: 1, | ||
| WebkitBoxOrient: "vertical", | ||
| overflow: "hidden", | ||
| textOverflow: "ellipsis", | ||
| }); | ||
|
|
||
| export const expanded = style({ | ||
| display: "block", | ||
| overflow: "visible", | ||
| }); | ||
|
|
||
| export const tag = style({ | ||
| display: "flex", | ||
| alignItems: "center", | ||
| gap: "0.8rem", | ||
| padding: "0.8rem 1.2rem", | ||
| borderRadius: radius.circle, | ||
| border: "1px solid rgba(255, 255, 255, 0.16)", | ||
| background: " rgba(0, 0, 0, 0.28)", | ||
| }); | ||
|
|
||
| export const tagIcon = style({ | ||
| width: "1.6rem", | ||
| height: "1.6rem", | ||
| display: "flex", | ||
| alignItems: "center", | ||
| justifyContent: "center", | ||
| color: semantic.icon.white, | ||
| }); | ||
|
|
||
| export const descriptionOverlay = style({ | ||
| position: "absolute", | ||
| bottom: 0, | ||
| left: 0, | ||
| right: 0, | ||
| height: "60%", | ||
| background: | ||
| "linear-gradient(180deg, rgba(40, 40, 40, 0.00) 0%, #282828 100%)", | ||
| }); |
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.
오오우,,!