-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/234 #259
Merged
Merged
Feat/234 #259
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bb84361
[feat]: 메인페이지의 상품 리스트 컴포넌트 타이틀/영역구현(#234)
devkyoung2 05391c8
[refactor]: ColumnProductItem 컴포넌트 여백 조정(#234)
devkyoung2 51af44e
[styles]: 사용되지 않는 컴포넌트 주석(#234)
devkyoung2 c82d0fc
[feat]: 메인페이지 하단 여백 추가(#234)
devkyoung2 0b1dc3e
Merge branch 'dev' into feat/234
devkyoung2 960b20a
[feat]: 메인페이지의 상품 리스트 컴포넌트 구현(#234)
devkyoung2 857c48f
[style]: 불필요한 줄바꿈 삭제(#234)
devkyoung2 fe6156c
[refactor]: 여백 값 수정(#234)
devkyoung2 9f6377c
[refactor]: 불필요한 axios 인스턴스 제거(#234)
devkyoung2 0e18934
[refactor]: 여백 값 수정(#234)
devkyoung2 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 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 'styles/mixins.module'; | ||
|
||
.area_thema { | ||
padding-top: 120px; | ||
|
||
.txt_title { | ||
@include font(35px, 700); | ||
|
||
display: block; | ||
padding-bottom: 40px; | ||
text-align: center; | ||
line-height: 51px; | ||
} | ||
|
||
.wrapper_item { | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
gap: 50px 20px; | ||
} | ||
} |
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,35 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import ColumnProductItem from 'components/feature/ProductItem/ColumnProductItem'; | ||
import Spinner from 'components/ui/Spinner'; | ||
|
||
import { getThemaItems } from 'services/api/v1/thema'; | ||
|
||
import styles from './index.module.scss'; | ||
|
||
type ThemaListProps = { categoryId: number; title: string }; | ||
|
||
const ThemaList = ({ categoryId, title }: ThemaListProps) => { | ||
const { data: themaItems, isLoading } = useQuery({ | ||
queryKey: ['themaItems', categoryId], | ||
queryFn: () => getThemaItems(categoryId), | ||
}); | ||
|
||
if (isLoading) return <Spinner />; | ||
return ( | ||
themaItems && ( | ||
<section className={styles.area_thema}> | ||
<strong className={styles.txt_title}>{title}</strong> | ||
<ul className={styles.wrapper_item}> | ||
{themaItems.map((item) => ( | ||
<li key={item.productId}> | ||
<ColumnProductItem product={item} size="medium" /> | ||
</li> | ||
))} | ||
</ul> | ||
</section> | ||
) | ||
); | ||
}; | ||
|
||
export default ThemaList; |
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 |
---|---|---|
@@ -1,5 +1,51 @@ | ||
import ThemaList from './ThemaList'; | ||
|
||
const TITLE = [ | ||
'전하고픈 마음 가득 담아', | ||
'센스 넘치는 선물', | ||
'이런 선물 어때요 ?', | ||
'남녀노소 모두 좋아하는 선물', | ||
'반짝반짝 빛나는 마음', | ||
'부담 없이 마음을 전해요', | ||
'말없이 응원하고 싶을 때🍀', | ||
'이런 선물도 좋을 것 같아요.', | ||
'귀여운 게 최고야', | ||
'달콤한 진심을 전하는 선물', | ||
'고마운 사람들에게 전해요🎁', | ||
'변치 않는 마음을 전해요', | ||
'지금 안 사면 손해입니다 🚨', | ||
'전하고픈 마음 가득 담아', | ||
'활용도 높은 집들이 선물', | ||
'마음을 전하는 빛나는 선물', | ||
]; | ||
|
||
const CATEGORY_ID = [ | ||
170, 171, 172, 176, 177, 178, 179, 181, 182, 184, 185, 188, 192, 194, 195, | ||
196, 202, 203, 204, 205, | ||
]; | ||
|
||
const getRandomCategoryId = () => { | ||
const categoryIdx = Math.floor(Math.random() * CATEGORY_ID.length); | ||
return CATEGORY_ID[categoryIdx]; | ||
}; | ||
|
||
const getRandomTitle = () => { | ||
const titleIdx = Math.floor(Math.random() * TITLE.length); | ||
return TITLE[titleIdx]; | ||
}; | ||
Comment on lines
+27
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
const Thema = () => { | ||
return <>이런 선물 어때요?</>; | ||
return ( | ||
<> | ||
<ThemaList categoryId={getRandomCategoryId()} title={getRandomTitle()} /> | ||
<ThemaList categoryId={getRandomCategoryId()} title={getRandomTitle()} /> | ||
<ThemaList categoryId={getRandomCategoryId()} title={getRandomTitle()} /> | ||
<ThemaList categoryId={getRandomCategoryId()} title={getRandomTitle()} /> | ||
<ThemaList categoryId={getRandomCategoryId()} title={getRandomTitle()} /> | ||
<ThemaList categoryId={getRandomCategoryId()} title={getRandomTitle()} /> | ||
<ThemaList categoryId={getRandomCategoryId()} title={getRandomTitle()} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Thema; |
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,3 @@ | ||
.area_home { | ||
padding-bottom: 200px; | ||
} |
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,11 @@ | ||
import { ProductItem } from 'types/productItem'; | ||
|
||
import { apiV1 } from '.'; | ||
|
||
export const getThemaItems = async (categoryId: number) => { | ||
const themaItem = await apiV1.get( | ||
`/products?size=4&categoryId=${categoryId}`, | ||
); | ||
|
||
return themaItem.data.content as ProductItem[]; | ||
}; |
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.
살짝 하드코딩의 느낌이 나지만 어쩔 도리가 없어보이네요 😅
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.
ㅠㅠ 개인적으로 프론트에서 카테고리 id를 랜덤으로 선택해서 보내는게 애매하다는 생각이 들지만 아예 다른부분의 api를 가져다 쓰고있기 때문에 어쩔수 없네요..