-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 유저 활동 내역 및 상품 mock data 추가 (#35)
- Loading branch information
Showing
9 changed files
with
269 additions
and
16 deletions.
There are no files selected for viewing
Empty file.
23 changes: 23 additions & 0 deletions
23
...pp/(userpage)/otherpage/[userId]/components/UserActivityList/UserActivityList.module.scss
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,23 @@ | ||
@import "@/styles/_index"; | ||
@import "@/styles/_media"; | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
} | ||
|
||
.buttonBox { | ||
display: flex; | ||
align-items: center; | ||
justify-content: start; | ||
gap: 40px; | ||
} | ||
|
||
.selectButton { | ||
all: unset; | ||
} | ||
|
||
.active { | ||
color: red; | ||
} |
51 changes: 51 additions & 0 deletions
51
src/app/(userpage)/otherpage/[userId]/components/UserActivityList/UserActivityList.tsx
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,51 @@ | ||
import React, { useState } from "react"; | ||
import { productMock } from "@/app/(userpage)/productMock"; | ||
import cn from "@/utils/classNames"; | ||
import styles from "./UserActivityList.module.scss"; | ||
// eslint-disable-next-line no-restricted-imports | ||
import UserProductList from "../UserProductList/UserProductList"; | ||
|
||
export default function UserActivityList() { | ||
const [button, setButton] = useState<string>("reviewed"); | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<div className={cn(styles.buttonBox)}> | ||
<div | ||
className={cn(styles.selectButton, styles[`${button === "reviewed" ? "active" : ""}`])} | ||
onClick={() => { | ||
setButton("reviewed"); | ||
}} | ||
onKeyDown={() => setButton("reviewed")} | ||
role='button' | ||
tabIndex={0} | ||
> | ||
리뷰 남긴 상품 | ||
</div> | ||
<div | ||
className={cn(styles.selectButton, styles[`${button === "created" ? "active" : ""}`])} | ||
onClick={() => { | ||
setButton("created"); | ||
}} | ||
onKeyDown={() => setButton("created")} | ||
role='button' | ||
tabIndex={0} | ||
> | ||
등록한 상품 | ||
</div> | ||
<div | ||
className={cn(styles.selectButton, styles[`${button === "favorite" ? "active" : ""}`])} | ||
onClick={() => { | ||
setButton("favorite"); | ||
}} | ||
onKeyDown={() => setButton("favorite")} | ||
role='button' | ||
tabIndex={0} | ||
> | ||
찜한 상품 | ||
</div> | ||
</div> | ||
<UserProductList list={productMock} /> | ||
</div> | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/app/(userpage)/otherpage/[userId]/components/UserProductList/UserProductList.module.scss
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,14 @@ | ||
@import "@/styles/_index"; | ||
@import "@/styles/_media"; | ||
|
||
.container { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
gap: 20px; | ||
width: 100%; | ||
|
||
@include respond-to(tablet) { | ||
grid-template-columns: 1fr 1fr; | ||
gap: 15px; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/app/(userpage)/otherpage/[userId]/components/UserProductList/UserProductList.tsx
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,24 @@ | ||
import Link from "next/link"; | ||
import { ProductCard } from "@/components/ProductCard"; | ||
import cn from "@/utils/classNames"; | ||
import styles from "./UserProductList.module.scss"; | ||
import type { ProductType } from "@/types/global"; | ||
|
||
type ProductListProps = { | ||
list: ProductType[]; | ||
}; | ||
|
||
export default function UserProductList({ list }: ProductListProps) { | ||
return ( | ||
<div className={cn(styles.container)}> | ||
{list.map((item) => ( | ||
<Link | ||
href={`/product/${item.id}`} | ||
key={item.id} | ||
> | ||
<ProductCard product={item} /> | ||
</Link> | ||
))} | ||
</div> | ||
); | ||
} |
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,88 @@ | ||
import { DEFAULT_PRODUCT_IMAGE } from "@/utils/constant"; | ||
|
||
export const productMock = [ | ||
{ | ||
updatedAt: new Date("2024-05-30T09:41:57.081Z"), | ||
createdAt: new Date("2024-05-30T09:41:57.081Z"), | ||
writerId: 1, | ||
categoryId: 1, | ||
favoriteCount: 0, | ||
reviewCount: 0, | ||
rating: 0, | ||
image: `${DEFAULT_PRODUCT_IMAGE}`, | ||
name: "string", | ||
id: 1, | ||
}, | ||
{ | ||
updatedAt: new Date("2024-05-30T09:41:57.081Z"), | ||
createdAt: new Date("2024-05-30T09:41:57.081Z"), | ||
writerId: 1, | ||
categoryId: 1, | ||
favoriteCount: 0, | ||
reviewCount: 0, | ||
rating: 0, | ||
image: `${DEFAULT_PRODUCT_IMAGE}`, | ||
name: "string", | ||
id: 1, | ||
}, | ||
{ | ||
updatedAt: new Date("2024-05-30T09:41:57.081Z"), | ||
createdAt: new Date("2024-05-30T09:41:57.081Z"), | ||
writerId: 1, | ||
categoryId: 1, | ||
favoriteCount: 0, | ||
reviewCount: 0, | ||
rating: 0, | ||
image: `${DEFAULT_PRODUCT_IMAGE}`, | ||
name: "string", | ||
id: 1, | ||
}, | ||
{ | ||
updatedAt: new Date("2024-05-30T09:41:57.081Z"), | ||
createdAt: new Date("2024-05-30T09:41:57.081Z"), | ||
writerId: 1, | ||
categoryId: 1, | ||
favoriteCount: 0, | ||
reviewCount: 0, | ||
rating: 0, | ||
image: `${DEFAULT_PRODUCT_IMAGE}`, | ||
name: "string", | ||
id: 1, | ||
}, | ||
{ | ||
updatedAt: new Date("2024-05-30T09:41:57.081Z"), | ||
createdAt: new Date("2024-05-30T09:41:57.081Z"), | ||
writerId: 1, | ||
categoryId: 1, | ||
favoriteCount: 0, | ||
reviewCount: 0, | ||
rating: 0, | ||
image: `${DEFAULT_PRODUCT_IMAGE}`, | ||
name: "string", | ||
id: 1, | ||
}, | ||
{ | ||
updatedAt: new Date("2024-05-30T09:41:57.081Z"), | ||
createdAt: new Date("2024-05-30T09:41:57.081Z"), | ||
writerId: 1, | ||
categoryId: 1, | ||
favoriteCount: 0, | ||
reviewCount: 0, | ||
rating: 0, | ||
image: `${DEFAULT_PRODUCT_IMAGE}`, | ||
name: "string", | ||
id: 1, | ||
}, | ||
{ | ||
updatedAt: new Date("2024-05-30T09:41:57.081Z"), | ||
createdAt: new Date("2024-05-30T09:41:57.081Z"), | ||
writerId: 1, | ||
categoryId: 1, | ||
favoriteCount: 0, | ||
reviewCount: 0, | ||
rating: 0, | ||
image: `${DEFAULT_PRODUCT_IMAGE}`, | ||
name: "string", | ||
id: 1, | ||
}, | ||
]; |
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,36 @@ | ||
export type UserDetail = { | ||
updatedAt: Date; | ||
createdAt: Date; | ||
teamId: string; | ||
image: string; | ||
description: string; | ||
nickname: string; | ||
id: number; | ||
mostFavoriteCategory: { | ||
name: string; | ||
id: number; | ||
}; | ||
averageRating: number; | ||
reviewCount: number; | ||
followeesCount: number; | ||
followersCount: number; | ||
isFollowing: boolean; | ||
}; | ||
|
||
export type UserProduct = { | ||
nextCursor: number; | ||
list: [ | ||
{ | ||
updatedAt: Date; | ||
createdAt: Date; | ||
writerId: number; | ||
categoryId: number; | ||
favoriteCount: number; | ||
reviewCount: number; | ||
rating: number; | ||
image: string; | ||
name: string; | ||
id: number; | ||
}, | ||
]; | ||
}; |
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,20 @@ | ||
import { DEFAULT_PROFILE_IMAGE } from "@/utils/constant"; | ||
|
||
export const userMock = { | ||
updatedAt: "2024-06-03T10:18:50.930Z", | ||
createdAt: "2024-06-03T10:18:50.930Z", | ||
teamId: "string", | ||
image: `${DEFAULT_PROFILE_IMAGE}`, | ||
description: "string", | ||
nickname: "string", | ||
id: 1, | ||
mostFavoriteCategory: { | ||
name: "전자기기", | ||
id: 1, | ||
}, | ||
averageRating: 0, | ||
reviewCount: 0, | ||
followeesCount: 0, | ||
followersCount: 0, | ||
isFollowing: true, | ||
}; |