Skip to content

Commit dddf245

Browse files
authored
Merge pull request #106 from YAPP-Github/feature/PRODUCT-182
feat: 스토리 조회 구현 (#85)
2 parents 46c7417 + 85800ae commit dddf245

24 files changed

Lines changed: 461 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
"@vanilla-extract/recipes": "^0.5.7",
3030
"clsx": "^2.1.1",
3131
"es-toolkit": "^1.39.7",
32-
"framer-motion": "^12.23.9",
3332
"iron-session": "^8.0.4",
3433
"ky": "1.7.5",
34+
"motion": "^12.23.11",
3535
"lottie-react": "^2.4.1",
3636
"next": "15.3.2",
3737
"overlay-kit": "^1.8.4",

pnpm-lock.yaml

Lines changed: 28 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/(search)/_api/search.api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { authHttp } from "@/lib/api";
1+
import { http } from "@/lib/api";
22

33
import { type StoreSearchResponse } from "./search.types";
44

@@ -10,7 +10,7 @@ import { type StoreSearchResponse } from "./search.types";
1010
export const getStoreSearch = async (
1111
query: string
1212
): Promise<StoreSearchResponse> => {
13-
return await authHttp
13+
return await http
1414
.get("api/shop/search", {
1515
searchParams: { query },
1616
})

src/app/(search)/_components/SearchStoreBottomSheet/SearchStoreBottomSheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useQuery } from "@tanstack/react-query";
4-
import { AnimatePresence, motion } from "framer-motion";
4+
import { AnimatePresence, motion } from "motion/react";
55
import { type ReactNode, useCallback, useEffect, useState } from "react";
66
import { useForm } from "react-hook-form";
77
import { useDebounce } from "react-simplikit";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { style } from "@vanilla-extract/css";
2+
3+
import { radius } from "@/styles";
4+
5+
export const avatar = style({
6+
width: "3.4rem",
7+
height: "3.4rem",
8+
display: "flex",
9+
alignItems: "center",
10+
justifyContent: "center",
11+
padding: "0.6rem",
12+
borderRadius: radius.circle,
13+
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import Bapurit from "@/assets/logo/symbol.svg";
2+
3+
import { PROFILE_COLORS } from "../../_constants";
4+
import { getProfileColorIndex } from "../../_utils";
5+
import * as styles from "./Avatar.css";
6+
7+
type AvatarProps = {
8+
/** 사용자 고유 ID */
9+
memberId: number;
10+
11+
className?: string;
12+
};
13+
14+
/**
15+
* 사용자별 고유한 색상 배경을 가진 프로필 아바타 컴포넌트
16+
*
17+
* @description
18+
* memberId를 기반으로 3가지 색상(노랑, 분홍, 파랑) 중 하나를 자동으로 할당합니다.
19+
* 같은 memberId는 항상 같은 색상을 가집니다.
20+
*
21+
* @example
22+
* ```tsx
23+
* <Avatar memberId={123} />
24+
* <Avatar memberId={story.memberId} />
25+
* ```
26+
*/
27+
export const Avatar = ({ memberId, className }: AvatarProps) => {
28+
const colorIndex = getProfileColorIndex(memberId);
29+
const colorConfig = PROFILE_COLORS[colorIndex];
30+
31+
return (
32+
<div
33+
className={`${styles.avatar} ${className || ""}`}
34+
style={{
35+
backgroundColor: colorConfig.background,
36+
}}
37+
>
38+
<Bapurit width={23} height={23} />
39+
</div>
40+
);
41+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { Avatar } from "./Avatar";

src/app/member/_constants/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./profileColors.constants";
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export const PROFILE_COLORS = {
2+
0: {
3+
background: "#FFF1AF",
4+
name: "yellow",
5+
},
6+
1: {
7+
background: "#FFDDDA",
8+
name: "pink",
9+
},
10+
2: {
11+
background: "#C9ECFF",
12+
name: "blue",
13+
},
14+
} as const;
15+
16+
export type ProfileColorIndex = keyof typeof PROFILE_COLORS;
17+
18+
// 프로필 색상의 개수
19+
export const PROFILE_COLOR_COUNT = Object.keys(PROFILE_COLORS).length;

src/app/member/_utils/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export { phoneNumberUtils } from "./phoneNumberUtils";
1+
export * from "./phoneNumberUtils";
2+
export * from "./profileUtils";

0 commit comments

Comments
 (0)