Skip to content
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

refactor: 상품 페이지 개편 #50

Merged
merged 23 commits into from
Mar 19, 2024
Merged

refactor: 상품 페이지 개편 #50

merged 23 commits into from
Mar 19, 2024

Conversation

Leejin-Yang
Copy link
Contributor

@Leejin-Yang Leejin-Yang commented Mar 17, 2024

Issue

✨ 구현한 기능

  • 기존 상품 페이지를 새 디자인으로 개편했습니다.
  • 기타 컴포넌트 리팩터링 했습니다.
    • TabMenu (이 과정에서 기존에 쓰이던 곳에서 걍 삭제함)
    • CategoryList, CategoryItem
스크린샷 2024-03-18 00 37 30 스크린샷 2024-03-18 00 37 40

📢 논의하고 싶은 내용

  • 기존에 인덱스로 작동하던 탭을 value와 label을 받도록 했습니다. 사실 탭이 또 어디 있을지 모르겠네요.
  • 카테고리도 홈과 상품 두 분류를 두어 사용하도록 했습니다.. 이 부분도 확인 부탁드립니다
  • 상품 페이지 컴포넌트 이름 변경했습니다 ProductListPage -> ProductPage. 그리고 url 변경도 있습니다(/products). 추후 목록 페이지 만들면 그때 /products/food, /products/store 가 생길 예정입니다.
  • 상품 페이지 보면 카테고리가 필요해 카테고리 쿼리를 사용해 파라미터를 받는 쿼리도 하나 만들었습니다. 그냥 카테고리 리스트 컴포넌트도 통합할까요? 이거 저번에 왜 나눴는지 까먹음

🎸 기타

  • 특이 사항이 있으면 작성합니다.

⏰ 일정

  • 추정 시간 : 4시간
  • 걸린 시간 : 6시간

Copy link

🔗 배포된 storybook 주소: https://65f015a4aed45406385006ee-xacckobqsc.chromatic.com/

Copy link
Member

@xodms0309 xodms0309 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생했어요 황펭... 코드 보는데도 빡세네요 6시간이라니
일단 제 의견을 전달하자면

  • 카테고리 이미지가 원형으로 변하면서 사이즈가 애매한 것 같은데 디자이너분께 보여드리는거 어떠신가요??
  • 카테고리 리스트 컴포넌트 나눈 이유 api 두 개 한번에 안쏠려고 그랬던걸로 기억..
  • 그리고 가로 스크롤 안보이게 하는거 어때요?!

아무튼 나머지는 코멘트 확인해주시고~~~ 고생하셨습니다~~~~~

handleTabMenuSelect: (index: number) => void;
tabMenus: Tab[];
selectedTabMenu: string;
handleTabMenuSelect: (selectedMenu: any) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any..! 이거 타입이 바뀌었나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제네릭 해보다가 실패해서 걍 애니 했슴다..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

눈물난다..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뚀르륵,,,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 의견 있음 주세요..

Comment on lines +25 to +28
export const menuName = styleVariants({
active: [menuNameBase, { fontWeight: 700, color: '#232527', borderBottom: '3px solid #444' }],
default: [menuNameBase, { fontWeight: 600, color: '#999' }],
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하 이거 이렇게 쓰는거군여?

@@ -1,18 +1,16 @@
import { useState } from 'react';

const INIT_TAB_INDEX = 0;
const useTabMenu = <T = string>(init: T) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 init이 처음에 선택된 메뉴라는 뜻인가여?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옙 초기값이요

@@ -37,9 +38,15 @@ const CategoryItem = ({ categoryId, name, image, categoryType }: CategoryItemPro
return (
<button type="button" onClick={() => handleCategoryItemClick(categoryId)}>
<div className={imageWrapper}>
<img className={categoryImage} src={image.src} width={image.width} height={image.height} alt={name} />
<img
className={cx(categoryImage, { [circle]: isCircular })}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cx <- 이거 쓴 이유가 뭐에요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조건부 클래스네임 줄 때 유용한 라이브러리라 사용했슴다
https://github.com/JedWatson/classnames

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 바닐라익스트랙트만으로는 해결 안되나요?????? 궁금

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바닐라 익스트랙트에는 불리언 값을 넘겨줄 수 없어서 안 될거 같네요..?

TabMenu,
SectionHeader,
} from '@/components/Common';
import ProductPreviewList from '@/components/Product/ProductPreviewList/ProductPreviewList';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 index.ts에서 import 안된거 같아여

import ProductPreviewList from '@/components/Product/ProductPreviewList/ProductPreviewList';
import { CATEGORY_TYPE } from '@/constants';
import { useTabMenu } from '@/hooks/common';
import { useCategoryQuery } from '@/hooks/queries/product/useCategoryQuery';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기두

Comment on lines 40 to 44
{selectedTabMenu === TAB_MENUS[0].value ? (
<CategoryFoodList location="products" hasName isCircular />
) : (
<CategoryStoreList location="products" hasName />
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{selectedTabMenu === TAB_MENUS[0].value ? (
<CategoryFoodList location="products" hasName isCircular />
) : (
<CategoryStoreList location="products" hasName />
)}
<CategoryFoodList location="products" hasName isCircular={selectedTabMenu === TAB_MENUS[0].value } />

이렇게 쓰는건 어떠신가요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

두개가 다른 리스트인데 합칠까요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엥 다른거네!

@@ -2,22 +2,41 @@ import { categoryFoodListWrapper } from './categoryFoodList.css';
import CategoryItem from '../CategoryItem/CategoryItem';

import { CATEGORY_TYPE } from '@/constants';
import { useCategoryFoodQuery } from '@/hooks/queries/product';
import { useCategoryFoodQuery } from '@/hooks/queries/product/useCategoryQuery';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 index.ts!

@Leejin-Yang
Copy link
Contributor Author

Leejin-Yang commented Mar 18, 2024

@xodms0309

  • 카테고리 이미지가 원형으로 변하면서 사이즈가 애매한 것 같은데 디자이너분께 보여드리는거 어떠신가요??

옙 좋습니다~

  • 카테고리 리스트 컴포넌트 나눈 이유 api 두 개 한번에 안쏠려고 그랬던걸로 기억..

우짤까요. 저는 합쳐서 컴포넌트 하나로 써도 괜찮을거 같은데. 타입별로 스타일 만들어서

  • 그리고 가로 스크롤 안보이게 하는거 어때요?!

굿굿 레이아웃 pr에 적용했읍니다

Copy link

🔗 배포된 storybook 주소: https://65f015a4aed45406385006ee-ggoedcbilu.chromatic.com/

Copy link
Contributor

@hae-on hae-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

진짜진짜 수고 많았습니다!
테스트까지 작성하셨군요???
근데 접때 테스트 아예 안돌아가던데 어캐 해결하셨죠???

const categoryType = CATEGORY_TYPE.STORE;

const CategoryStoreList = () => {
const { data: categories } = useCategoryStoreQuery(categoryType);
const imgSize = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

얘는 진짜 width만 2밖에 차이 안나는거라서, 디자이너분한테 하나로 고정시켜달라고 말하는게 좋을 거 같네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋슴다

handleTabMenuSelect: (index: number) => void;
tabMenus: Tab[];
selectedTabMenu: string;
handleTabMenuSelect: (selectedMenu: any) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뚀르륵,,,

@Leejin-Yang
Copy link
Contributor Author

@hae-on
훅 수정한거에 맞게 하니 되더라구요.?

Copy link

🔗 배포된 storybook 주소: https://65f015a4aed45406385006ee-jhwlonyalt.chromatic.com/

Copy link

🔗 배포된 storybook 주소: https://65f015a4aed45406385006ee-zyhomlndga.chromatic.com/

@Leejin-Yang
Copy link
Contributor Author

@xodms0309 @hae-on

광고 영역은 일단 두고 레이아웃에 맞게 수정했슴다

스크린샷 2024-03-19 23 54 17 스크린샷 2024-03-19 23 54 14

Copy link

🔗 배포된 storybook 주소: https://65f015a4aed45406385006ee-azsxhzifhb.chromatic.com/

@Leejin-Yang Leejin-Yang merged commit 3935d2f into feat/v2 Mar 19, 2024
2 of 3 checks passed
@Leejin-Yang Leejin-Yang deleted the feat/issue-41 branch March 19, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

상품 페이지 개편
3 participants