-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: 파일명 변경 * chore: 카테고리 이미지 추가 * feat: category item 구현 * chore: 이미지 s3로 이동 * refactor: 카테고리 아이템 수정 * refactor: home 분기 삭제 * refactor: button으로 변경 * feat: 카테고리 리스트 구현 * refactor: home 화면 category 디자인 수정 * refactor: key 이름 변경 * feat: 배너 추가 * refactor: 배너 링크 추가 * refactor: 간격 조절 * chore: 이미지 삭제 * chore: 배너 경로 TODO 작성 * refactor: 캐러셀 디자인 수정 * refactor: 폰트 단위 수정 * chore: tab -> menu로 변경 * refactor: 리뷰 반영 * refactor: 카테고리 json 수정 * refactor: 카테고리 클릭 시 이동하도록 수정 * refactor: 카테고리 이동 구현
- Loading branch information
Showing
16 changed files
with
227 additions
and
81 deletions.
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
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.