-
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
[FE] refactor: 홈 화면 변경 #628
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bee3e61
chore: 파일명 변경
hae-on 4d029d2
chore: 카테고리 이미지 추가
hae-on af8a065
feat: category item 구현
hae-on 17506a4
chore: develop merge
hae-on 7632b12
chore: 이미지 s3로 이동
hae-on a40e10b
refactor: 카테고리 아이템 수정
hae-on 2d521ae
refactor: home 분기 삭제
hae-on f193e59
refactor: button으로 변경
hae-on bf3a3da
feat: 카테고리 리스트 구현
hae-on 09e534e
refactor: home 화면 category 디자인 수정
hae-on 61e167c
refactor: key 이름 변경
hae-on fb3d02d
feat: 배너 추가
hae-on ec48d4f
refactor: 배너 링크 추가
hae-on 89ff622
refactor: 간격 조절
hae-on 9231ee5
chore: 이미지 삭제
hae-on ed8d19e
chore: 배너 경로 TODO 작성
hae-on 6794cba
refactor: 캐러셀 디자인 수정
hae-on a85ed74
refactor: 폰트 단위 수정
hae-on 24020c2
chore: develop merge
hae-on 3b5d86d
chore: tab -> menu로 변경
hae-on 8c7c436
refactor: 리뷰 반영
hae-on 16b8edd
refactor: 카테고리 json 수정
hae-on f9b371b
refactor: 카테고리 클릭 시 이동하도록 수정
hae-on d6b0b9f
refactor: 카테고리 이동 구현
hae-on 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
17 changes: 17 additions & 0 deletions
17
frontend/src/components/Common/CategoryItem/CategoryItem.stories.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,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import CategoryItem from './CategoryItem'; | ||
|
||
const meta: Meta<typeof CategoryItem> = { | ||
title: 'common/CategoryItem', | ||
component: CategoryItem, | ||
args: { | ||
name: '즉석 식품', | ||
image: 'https://tqklhszfkvzk6518638.cdn.ntruss.com/product/8801771029052.jpg', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof CategoryItem>; | ||
|
||
export const Default: Story = {}; |
48 changes: 48 additions & 0 deletions
48
frontend/src/components/Common/CategoryItem/CategoryItem.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,48 @@ | ||
import { Button } from '@fun-eat/design-system'; | ||
import styled from 'styled-components'; | ||
|
||
interface CategoryItemProps { | ||
name: string; | ||
image: string; | ||
} | ||
|
||
const CategoryItem = ({ name, image }: CategoryItemProps) => { | ||
return ( | ||
<CategoryItemContainer variant="transparent"> | ||
<ImageWrapper> | ||
<img src={image} width={60} height={60} alt={name} /> | ||
</ImageWrapper> | ||
<CategoryName>{name}</CategoryName> | ||
</CategoryItemContainer> | ||
); | ||
}; | ||
|
||
export default CategoryItem; | ||
|
||
const CategoryItemContainer = styled(Button)` | ||
width: 60px; | ||
height: 100px; | ||
text-align: center; | ||
`; | ||
|
||
const ImageWrapper = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 60px; | ||
height: 60px; | ||
border-radius: 10px; | ||
background: ${({ theme }) => theme.colors.white}; | ||
|
||
img { | ||
width: 100%; | ||
height: auto; | ||
object-fit: cover; | ||
} | ||
`; | ||
|
||
const CategoryName = styled.p` | ||
margin-top: 10px; | ||
font-weight: 600; | ||
font-size: 0.8rem; | ||
`; |
13 changes: 13 additions & 0 deletions
13
frontend/src/components/Common/CategoryList/CategoryList.stories.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,13 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import CategoryList from './CategoryList'; | ||
|
||
const meta: Meta<typeof CategoryList> = { | ||
title: 'common/CategoryList', | ||
component: CategoryList, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof CategoryList>; | ||
|
||
export const Default: Story = {}; |
68 changes: 68 additions & 0 deletions
68
frontend/src/components/Common/CategoryList/CategoryList.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,68 @@ | ||
import { Link } from '@fun-eat/design-system'; | ||
import { Link as RouterLink } from 'react-router-dom'; | ||
import styled from 'styled-components'; | ||
|
||
import CategoryItem from '../CategoryItem/CategoryItem'; | ||
|
||
import { MENU_IMAGES, MENU_NAME, STORE_IMAGES, STORE_NAMES } from '@/constants'; | ||
|
||
const MENU_LENGTH = 5; | ||
const STORE_LENGTH = 4; | ||
|
||
const menuList = Array.from({ length: MENU_LENGTH }, (_, index) => ({ | ||
name: MENU_NAME[index], | ||
image: MENU_IMAGES[index], | ||
})); | ||
|
||
const storeList = Array.from({ length: STORE_LENGTH }, (_, index) => ({ | ||
name: STORE_NAMES[index], | ||
image: STORE_IMAGES[index], | ||
})); | ||
|
||
const CategoryList = () => { | ||
return ( | ||
<CategoryListContainer> | ||
<MenuListWrapper> | ||
{menuList.map((menu, index) => ( | ||
<Link key={`menuItem-${index}`} as={RouterLink} to={`products/food?category=${index + 1}`}> | ||
<CategoryItem name={menu.name} image={menu.image} /> | ||
</Link> | ||
))} | ||
</MenuListWrapper> | ||
<StoreListWrapper> | ||
{storeList.map((menu, index) => ( | ||
<Link key={`menuItem-${index}`} as={RouterLink} to={`products/store?category=${index + 6}`}> | ||
<CategoryItem key={`storeItem-${index}`} name={menu.name} image={menu.image} /> | ||
</Link> | ||
))} | ||
</StoreListWrapper> | ||
</CategoryListContainer> | ||
); | ||
}; | ||
|
||
export default CategoryList; | ||
|
||
const CategoryListContainer = styled.div` | ||
overflow-x: auto; | ||
overflow-y: hidden; | ||
|
||
@media screen and (min-width: 500px) { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
&::-webkit-scrollbar { | ||
display: none; | ||
} | ||
`; | ||
|
||
const MenuListWrapper = styled.div` | ||
display: flex; | ||
gap: 20px; | ||
`; | ||
|
||
const StoreListWrapper = styled.div` | ||
display: flex; | ||
gap: 20px; | ||
`; |
10 changes: 5 additions & 5 deletions
10
...mon/CategoryMenu/CategoryMenu.stories.tsx → ...ommon/CategoryTab/CategoryTab.stories.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
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
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 |
---|---|---|
|
@@ -8,23 +8,17 @@ import { MoreButton } from '@/components/Common'; | |
import { PATH } from '@/constants/path'; | ||
import { useCategoryValueContext } from '@/hooks/context'; | ||
import { useInfiniteProductsQuery } from '@/hooks/queries/product'; | ||
import displaySlice from '@/utils/displaySlice'; | ||
|
||
interface PBProductListProps { | ||
isHomePage?: boolean; | ||
} | ||
|
||
const PBProductList = ({ isHomePage }: PBProductListProps) => { | ||
const PBProductList = () => { | ||
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 { categoryIds } = useCategoryValueContext(); | ||
|
||
const { data: pbProductListResponse } = useInfiniteProductsQuery(categoryIds.store); | ||
const pbProducts = pbProductListResponse.pages.flatMap((page) => page.products); | ||
const pbProductsToDisplay = displaySlice(isHomePage, pbProducts, 10); | ||
|
||
return ( | ||
<> | ||
<PBProductListContainer> | ||
{pbProductsToDisplay.map((pbProduct) => ( | ||
{pbProducts.map((pbProduct) => ( | ||
<li key={pbProduct.id}> | ||
<Link as={RouterLink} to={`${PATH.PRODUCT_LIST}/store/${pbProduct.id}`}> | ||
<PBProductItem pbProduct={pbProduct} /> | ||
|
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
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
[ | ||
{ "id": 1, "name": "즉석조리" }, | ||
{ "id": 2, "name": "과자" }, | ||
{ "id": 3, "name": "간편식사" }, | ||
{ "id": 4, "name": "아이스크림" }, | ||
{ "id": 5, "name": "식품" }, | ||
{ "id": 6, "name": "음료" } | ||
{ "id": 1, "name": "간편식사" }, | ||
{ "id": 2, "name": "과자류" }, | ||
{ "id": 3, "name": "아이스크림" }, | ||
{ "id": 4, "name": "식품" }, | ||
{ "id": 5, "name": "음료" } | ||
] |
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,6 @@ | ||
[ | ||
{ "id": 7, "name": "CU" }, | ||
{ "id": 8, "name": "GS25" }, | ||
{ "id": 9, "name": "이마트24" } | ||
{ "id": 6, "name": "CU" }, | ||
{ "id": 7, "name": "GS25" }, | ||
{ "id": 8, "name": "이마트24" }, | ||
{ "id": 9, "name": "세븐일레븐" } | ||
] |
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.
굿!