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

[Team23] 컴포넌트 트리 구조 추가 및 수정, 범용 Button, Label, Card 생성, Header, CarouselSection 생성 #4

Merged
merged 24 commits into from
Apr 21, 2021

Conversation

deprecated-hongbiii
Copy link
Collaborator

@deprecated-hongbiii deprecated-hongbiii commented Apr 20, 2021

Jenny

  1. 오늘 한 내용
    • Header 부분 전반적인 구조 및 styled-components 적용
    • mouseLeave, mouseEnter 적용
  2. 궁금한 내용
    • <ThemeProvider theme={theme}><ThemeProvider/> 이런식으로 컴포넌트를 감싸고 color: ${(props) => props.theme.colors.gray};를 적용하나, 윗단에 import theme from "파일경로" 해서 color: ${theme.colors.gray} 이렇게 주나 둘 다 작동해서 상관없어 보이는데 그게 맞는걸까용?

Adela

  1. 오늘 한 내용
    • 범용 Button, Label 컴포넌트 생성
    • styled-component 적용
  2. 궁금한 내용
    • 현재 Label.jsx, Button.jsx에서 variable처럼 사용하는 객체를 가지고 있는데, contant.js 에다가 저장하는게 좀 더 자연스러울까요?
    • fetch 받아오는 데이터는 각 탭 혹은 버튼을 누를 때마다 그에 해당하는 데이터를 요청하는 것이 더 나은가요? 아니면 한꺼번에 받아와놓고 필요한 부분만 조건부로 렌더링 하는 방식으로 구현하는 것이 더 좋을까요?

Autumn

  1. 오늘 한 내용
    • Card, Price 컴포넌트 생성
  2. 궁금한 내용
    • Styled component와 그냥 tag에 className=""를 혼용해서 써도 괜찮을지, 한 가지로 통일하는 게 좋은지 궁금합니다. 지난 프로젝트에서는 모든 태그를 다 Styled component로 썼었는데, 개인적인 느낌으로는 컴포넌트가 너무 많은 것 같기도 하고 Styled component 안에서 중첩해서 태그 또는 클래스이름을 넣을 수 있어서 굳이 다 styled component로 만들 필요가 있나 싶어서요!
      혼용해서 쓴 예시는 1b7f635 커밋 -> Card.jsx 에 있습니다.
    • Styled component에 괜찮은(?) 네이밍 컨벤션이 있는지 궁금합니다. 검색해봐도 잘 모르겠어요 😓

현재까지 구상한 컴포넌트 구조

image

일감 나누기 스프레드 시트

👉 바로가기

deprecated-hongbiii and others added 24 commits April 20, 2021 11:31
- navbar 요소들 추가
- reset css같이 쓰이는 createGlobalStyle 사용
-로그인, 장바구니 style 적용
-hover스타일 적용
styled-component로 버튼, 라벨 컴포넌트 생성

1. /button
    - 공통적으로 사용된다고 생각하는 것들을 Button.jsx에 넣음
        - 각 버튼에 대한 type을 구별함
        - 추후 변수 이름을 수정할 수 있음
    - IconButton: 아이콘 모양을 가진 버튼들, 폰트어썸을 설치해서 사용함
    - TextButton: 주문하기 버튼에 대한 컴포넌트
2. Label
    - 각 라벨의 type을 구별하여 background 색을 다르게 설정함
- 일시품절 버튼 생성
- 근데 disable 처리를 안해준 것 같음 .. 해야함
- mouseEnter, mouseLeave 이벤트 처리
- firstChild에 style적용
- border-radius 먹임
- Test 컴포넌트 지움
- disabled 요소 추가
- disabled이면 cursor: not-allowed로 변경
@deprecated-hongbiii deprecated-hongbiii added the review-FE FE 리뷰 label Apr 20, 2021
@deprecated-hongbiii deprecated-hongbiii self-assigned this Apr 20, 2021
@deprecated-hongbiii deprecated-hongbiii changed the title [Team23] 컴포넌트 트리 구조 추가 및 수정 범용 Button, Label 생성 Header 생성 CarouselSection, 범용 Card 생성 [Team23] 컴포넌트 트리 구조 추가 및 수정, 범용 Button, Label, Card 생성, Header, CarouselSection 생성 Apr 21, 2021
@crongro crongro self-requested a review April 21, 2021 03:03
@crongro
Copy link

crongro commented Apr 21, 2021

  • <ThemeProvider theme={theme}><ThemeProvider/> 이런식으로 컴포넌트를 감싸고 color: ${(props) => props.theme.colors.gray};를 적용하나, 윗단에 import theme from "파일경로" 해서 color: ${theme.colors.gray} 이렇게 주나 둘 다 작동해서 상관없어 보이는데 그게 맞는걸까용?

그러네요. 성능상의 미미한 차이가 있을지모르겠지만, 같은 효과네요.
import를 했을때는 만약 path가 바뀌면 다 바꿔줘야 하니 좀 귀찮은 정도?

@crongro
Copy link

crongro commented Apr 21, 2021

  • 현재 Label.jsx, Button.jsx에서 variable처럼 사용하는 객체를 가지고 있는데, contant.js 에다가 저장하는게 좀 더 자연스러울까요?

상수값이 컴포넌트안에서만 사용하는 것이면 컴포넌트 안에 표현하는게 좋고요.
그렇지 않다면 밖에 선언해서 다른곳에서도 사용하고요.

그리고 만약 그 컴포넌트가 재사용 돼야 하고, 그 과정에서 방해가 되는 코드라면, 역시 빼는게 좋겠고요.

@crongro
Copy link

crongro commented Apr 21, 2021

  • fetch 받아오는 데이터는 각 탭 혹은 버튼을 누를 때마다 그에 해당하는 데이터를 요청하는 것이 더 나은가요? 아니면 한꺼번에 받아와놓고 필요한 부분만 조건부로 렌더링 하는 방식으로 구현하는 것이 더 좋을까요?

이건 장단점이 있겠네요.
그때그때 상황에 맞춰서 선택할 수 있어야겠습니다.
둘 다 괜찮고요.

물론, 기준이 되는 사항은, 사용자 경험(UX)입니다.

@crongro
Copy link

crongro commented Apr 21, 2021

  • Styled component와 그냥 tag에 className=""를 혼용해서 써도 괜찮을지, 한 가지로 통일하는 게 좋은지 궁금합니다. 지난 프로젝트에서는 모든 태그를 다 Styled component로 썼었는데, 개인적인 느낌으로는 컴포넌트가 너무 많은 것 같기도 하고 Styled component 안에서 중첩해서 태그 또는 클래스이름을 넣을 수 있어서 굳이 다 styled component로 만들 필요가 있나 싶어서요!

혼용하는건 좋지 않습니다.
스타일을 수정할때 여기저기를 찾아봐야하고요.
하나로 합치고 그 안에서 CSS 파일을 분리한다거나, 코드를 재사용하는 방법등으로 리팩토링하는 게 좋을 거 같습니다.

@crongro
Copy link

crongro commented Apr 21, 2021

  • Styled component에 괜찮은(?) 네이밍 컨벤션이 있는지 궁금합니다. 검색해봐도 잘 모르겠어요

팀이 한번 고민해보세요 ㅎ
좋은 방법을 찾아도 없으면, 나에게 , 우리에게 지금 직관적이고 쉬운 규칙이 뭘까? 생각하시고 결정하고,
일관성있게 그 규치을 따라서 하시면 될 듯.

Copy link

@crongro crongro left a comment

Choose a reason for hiding this comment

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

컴포넌트 잘 나눴네요.
한 명이 구현한것처럼 깔끔합니다.

function App() {
return (
<>
<GlobalStyle />
Copy link

Choose a reason for hiding this comment

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

GlobalStyle 적용좋네요. 내용이 커지면 App.jsx에서 분리하는 것도 좋겠네요.

font-weight: bold;
}
`;
const [isMouseOver, setIsMouseOver] = useState(false);
Copy link

Choose a reason for hiding this comment

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

useState가 스타일선언 중간쯤 있기보다 별도 위치하는 게 더 좋겠어요.

}
color: ${(props) => props.theme.colors.gray};
font-weight: "400";
`;
Copy link

Choose a reason for hiding this comment

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

스타일코드는 컴포넌트 함수 안에 선언하기 보다 밖에 선언하시죠.
컴포넌트내에는 JS로 로직만 표현하면 좋겠네요.


return (
<HeaderRightDiv>
<ThemeProvider theme={theme}>
Copy link

Choose a reason for hiding this comment

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

반복적으로 theme를 import하고, 여러컴포넌트에서 Provider를 제공하는거 같은데,
상위 컴포넌트쪽, 한군데에서만 Provider를 등록하면 되는거 아닌가요?

Comment on lines +9 to +15
fetch(
'https://h3rb9c0ugl.execute-api.ap-northeast-2.amazonaws.com/develop/baminchan/main'
)
.then((response) => response.json())
.then((result) => setProducts(result.body))
.then((error) => console.log('error', error));
}, []);
Copy link

Choose a reason for hiding this comment

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

특별한 경우가 아니면 async 함수로 통일하는 것도 좋죠.
마지막 error 가 들어오나요? catch 메서드를 사용하셔야..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

어떤 예제를 보고 따라했는데 에러 처리도 생각해보고 바꿔보겠습니당!! async로 통일도 해보겠습니다 👍

<StyledTitle>
<span>{product.title}</span>
</StyledTitle>
<StyledDescription>
Copy link

Choose a reason for hiding this comment

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

저도 네이밍에 Styled를 붙이는 것이 좋다고 생각하지만,

많은 개발자들이 이런 추가적인 타입(형태)을 이름에 붙이는 건 추천하지 않더군요.

@@ -0,0 +1,28 @@
const theme = {
Copy link

Choose a reason for hiding this comment

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

theme만 존재하니 constant.js 라고 하지 말고, theme.js 라고 하시죠.
constant.js 라고 하면 여기에 다른 상수들을 모두 다 모아둘 거 같아서요.
style은 JS에서 사용되는 값과는 조금 다르게 관리해도 될 거 같아요.

@crongro crongro merged commit 0471698 into codesquad-members-2021:aja Apr 21, 2021
crongro pushed a commit that referenced this pull request Apr 26, 2021
* Chore: 환경셋팅 및 폴더링

* Feat. MainMenu 마크업, itemCard 샘플 마크업#9

* Chore. 샘플카드 작성 #9

* Chore. Category 컴포넌트 생성

* Feat. Category UI #4

* Style. Add  Header Styled Component #18

* Chore : .gitignore 파일 생성

* Chore : 프로젝트 폴더인 BE 폴더 안에 .gitignore 파일 생성

* Chore : side dish 스프링 부트를 이용한 gradle 프로젝트 생성

* Feat : jdbc를 이용한 mysql 연결을 위해 application.properties 설정

* Feat : side dish 프로젝트의 schema.sql 파일 생성

* Chore: .gitignore 추가

* Style. Head style and react icon 추가 #18

* Feat. delivery 작업 중 #9

* Feat: dish 관련 클래스와 레포지토리 생성

기본 프로젝트 골격을 잡기 위해 Dish, DishController, DishRepository, DishService, BestDishResponseDTO의 틀 생성

* Feat: badge 관련 클래스와 레포지토리 생성

기본 프로젝트 골격을 잡기 위해 Badge, BadgeRepository 생성

* Style: Category style #4

* Feat. hover & badge 완료

* Style: Category UI #4

* Delete BE directory

* Delete .gitignore

* Feat. 초기데이터 fetch 요청
-Fetch custom Hook 작성
-초기데이터: 메인메뉴, 카테고리1번

* Feat. tabClick 효과 구현 #33, MainMenu Fetch #3

* Style. categorySlide 1줄 나열. #4

* Chore. 더보기 버튼 구현시작 #5

* Feat. 상세페이지 폼 구현
- 배경색설정/상세페이지 위치 가운데로 설정/x버튼구현
- x버튼 클릭  시 기존 페이지로 보여줌 #36

* Chore. 불필요한 코드, 파일 제외하여 pr하기

* Feat. 상세데이터 fetch  받아옴 #38

Co-authored-by: eamon3481 <68339352+eamon3481@users.noreply.github.com>
Co-authored-by: jeong-inho <derosatam76@gmail.com>
Co-authored-by: Jeong InHo <63284310+eNoLJ@users.noreply.github.com>
Malloc72P pushed a commit that referenced this pull request Apr 27, 2021
Malloc72P pushed a commit that referenced this pull request Apr 27, 2021
Malloc72P pushed a commit that referenced this pull request Apr 27, 2021
Malloc72P pushed a commit that referenced this pull request Apr 27, 2021
Malloc72P pushed a commit that referenced this pull request Apr 27, 2021
Malloc72P pushed a commit that referenced this pull request Apr 27, 2021
Malloc72P pushed a commit that referenced this pull request Apr 27, 2021
ksundong pushed a commit that referenced this pull request Apr 28, 2021
ksundong pushed a commit that referenced this pull request Apr 28, 2021
- 설계한 스키마에 따라 모델을 정의한다

issue: #4
ksundong pushed a commit that referenced this pull request Apr 28, 2021
- 모델을 Spring Data JDBC를 이용해서 연결
- 스키마 정의
- enum이 다른 테이블로 매핑이 안되는 문제

issue: #4
ksundong pushed a commit that referenced this pull request Apr 28, 2021
- Bage, DeliveryDay, DeliveryType에 Enum을 사용

issue: #4
ksundong pushed a commit that referenced this pull request Apr 28, 2021
- Spring Data JDBC의 추천에 따라 생성자와 팩토리 메서드
와 get메서드 추가

issue: #4
ksundong pushed a commit that referenced this pull request Apr 28, 2021
[BE] Model 설계 

closes #4
crongro pushed a commit that referenced this pull request May 3, 2021
* Chore. Category 컴포넌트 생성

* Feat. Category UI #4

* Style. Add  Header Styled Component #18

* Style. Head style and react icon 추가 #18

* Feat. delivery 작업 중 #9

* Style: Category style #4

* Feat. hover & badge 완료

* Style: Category UI #4

* Feat. 초기데이터 fetch 요청
-Fetch custom Hook 작성
-초기데이터: 메인메뉴, 카테고리1번

* Feat. tabClick 효과 구현 #33, MainMenu Fetch #3

* Style. categorySlide 1줄 나열. #4

* Chore. 더보기 버튼 구현시작 #5

* Feat. 상세페이지 폼 구현
- 배경색설정/상세페이지 위치 가운데로 설정/x버튼구현
- x버튼 클릭  시 기존 페이지로 보여줌 #36

* Chore. 불필요한 코드, 파일 제외하여 pr하기

* Feat: toggle button #5

* Feat. 상세데이터 fetch  받아옴 #38

* Feat: loading 중에 loading 이미지 삽입 #5

* Fix: 호버 이미지에 margin 적용 제거 #4

* Style: cursor and category title

* Feat. 배포API주소로 변경 (CATEGORY제외)

* Fix. REACT WARNING 수정: HEADER styled-components 선언 위치 수정

* Feat: env 파일에 url 넣기

* Chore: fetch 대신 axios 이용

* Fix: fetch error 임시로 고침

- detail 컴포넌트에서 처음에 fetch 받는 데이터를 유효한 url로 주어서 에러가 나오지 않게 했다.

* Fix: fetch error fix

- fetch hook 에 null 이 들어오면 fetch 를 하지 않게 해서 처음랜더링 될때 fetch 하지 않게 했음
- 더보기 클릭 연속으로하면 나타나는 warning Warning: Can't perform a React state update on an unmounted component.
-> useEffect에 클린함수로 상태값 초기화 시켜줘서 해결

* Fix: loading 화면 띄우게 하기

* Feat: Error handling

- useFetch 안에서 error 처리

* Fix: FeedBack 반영

- component 명칭 통일

* Fix: Feedback 반영

- ModalMode  => modalMode

* Feat: add Modal component

* Feat: loading gif MainMenu

* Feat: error component

* Chore. 복구

* Chore.  error 수정

* Feat. portal사용-> modalError 수정

* Fix: header hover 에러 고침

* Feat: stock 0 일시 버튼 disable

* Refactor: OrderBtn

* Feat. 수량 onChange 작업 중

* Chore. PRICEE + STOCK  관리 추가 MERGING

* Feat. 상세페이지 이미지클릭시 대표이미지 변경

* Feat. error 컴포넌트생성

* Feat. errorPage에서 메인홈으로 이동

* Chore. rebase FE

* Chore. rebase 2/13

* Chore : .gitignore 파일 생성

* Chore : 프로젝트 폴더인 BE 폴더 안에 .gitignore 파일 생성

* Chore : side dish 스프링 부트를 이용한 gradle 프로젝트 생성

* Feat : jdbc를 이용한 mysql 연결을 위해 application.properties 설정

* Feat : side dish 프로젝트의 schema.sql 파일 생성

* Chore: .gitignore 추가

* Feat: dish 관련 클래스와 레포지토리 생성

기본 프로젝트 골격을 잡기 위해 Dish, DishController, DishRepository, DishService, BestDishResponseDTO의 틀 생성

* Feat: badge 관련 클래스와 레포지토리 생성

기본 프로젝트 골격을 잡기 위해 Badge, BadgeRepository 생성

* Delete BE directory

* Delete .gitignore

* Chore. merging(error+oath)

* Feat. useFetch method전달방식 변경
- Ooath 인증코드 8080 포트로 post요청
-cors blocked

* Feat. 캐러셀 상세페이지 적용

* Feat. DetailPage 미니캐러셀 구현 중

* Feat. 재고주문api요청보냄, but실패

* Style : detailpage

* -

* Feat. LOGIN 요청중

* Chore. 로그인 작업구현중

* Feat. 재고수량 DB 업뎃가능, (새로고침시만)

* Fix: error

* Feat. Login구현
-atomic component화

* Feat. 받은 토큰으로 다시 get요청 ->  로그인정보 가져오기 구현

* Refactor . 파라미터 분해할당

* Chore. 불필요한 constant파일 삭제

* Feat.로그아웃 api 요청

* Update README.md

* Chore. igonore설정

* Chore.

* Chore. 끝나지않는 merge

* Feat. 범용성있는  Carousel은 전역 폴더링.
-기타 중복 파일 삭제

Co-authored-by: eamon3481 <68339352+eamon3481@users.noreply.github.com>
Co-authored-by: jeong-inho <derosatam76@gmail.com>
Co-authored-by: Jeong InHo <63284310+eNoLJ@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-FE FE 리뷰
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants