-
Notifications
You must be signed in to change notification settings - Fork 50
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
Conversation
- 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로 변경
[Adela] Feature/atom
Feature/header
그러네요. 성능상의 미미한 차이가 있을지모르겠지만, 같은 효과네요. |
상수값이 컴포넌트안에서만 사용하는 것이면 컴포넌트 안에 표현하는게 좋고요. 그리고 만약 그 컴포넌트가 재사용 돼야 하고, 그 과정에서 방해가 되는 코드라면, 역시 빼는게 좋겠고요. |
이건 장단점이 있겠네요. 물론, 기준이 되는 사항은, 사용자 경험(UX)입니다. |
혼용하는건 좋지 않습니다. |
팀이 한번 고민해보세요 ㅎ |
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.
컴포넌트 잘 나눴네요.
한 명이 구현한것처럼 깔끔합니다.
function App() { | ||
return ( | ||
<> | ||
<GlobalStyle /> |
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.
GlobalStyle 적용좋네요. 내용이 커지면 App.jsx에서 분리하는 것도 좋겠네요.
font-weight: bold; | ||
} | ||
`; | ||
const [isMouseOver, setIsMouseOver] = useState(false); |
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.
useState가 스타일선언 중간쯤 있기보다 별도 위치하는 게 더 좋겠어요.
} | ||
color: ${(props) => props.theme.colors.gray}; | ||
font-weight: "400"; | ||
`; |
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.
스타일코드는 컴포넌트 함수 안에 선언하기 보다 밖에 선언하시죠.
컴포넌트내에는 JS로 로직만 표현하면 좋겠네요.
|
||
return ( | ||
<HeaderRightDiv> | ||
<ThemeProvider theme={theme}> |
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.
반복적으로 theme를 import하고, 여러컴포넌트에서 Provider를 제공하는거 같은데,
상위 컴포넌트쪽, 한군데에서만 Provider를 등록하면 되는거 아닌가요?
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)); | ||
}, []); |
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.
특별한 경우가 아니면 async 함수로 통일하는 것도 좋죠.
마지막 error 가 들어오나요? catch 메서드를 사용하셔야..
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.
어떤 예제를 보고 따라했는데 에러 처리도 생각해보고 바꿔보겠습니당!! async로 통일도 해보겠습니다 👍
<StyledTitle> | ||
<span>{product.title}</span> | ||
</StyledTitle> | ||
<StyledDescription> |
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.
저도 네이밍에 Styled를 붙이는 것이 좋다고 생각하지만,
많은 개발자들이 이런 추가적인 타입(형태)을 이름에 붙이는 건 추천하지 않더군요.
@@ -0,0 +1,28 @@ | |||
const theme = { |
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.
theme만 존재하니 constant.js 라고 하지 말고, theme.js 라고 하시죠.
constant.js 라고 하면 여기에 다른 상수들을 모두 다 모아둘 거 같아서요.
style은 JS에서 사용되는 값과는 조금 다르게 관리해도 될 거 같아요.
* 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>
- 설계한 스키마에 따라 모델을 정의한다 issue: #4
- 모델을 Spring Data JDBC를 이용해서 연결 - 스키마 정의 - enum이 다른 테이블로 매핑이 안되는 문제 issue: #4
- Bage, DeliveryDay, DeliveryType에 Enum을 사용 issue: #4
- Spring Data JDBC의 추천에 따라 생성자와 팩토리 메서드 와 get메서드 추가 issue: #4
* 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>
Jenny
<ThemeProvider theme={theme}><ThemeProvider/>
이런식으로 컴포넌트를 감싸고color: ${(props) => props.theme.colors.gray};
를 적용하나, 윗단에import theme from "파일경로"
해서color: ${theme.colors.gray}
이렇게 주나 둘 다 작동해서 상관없어 보이는데 그게 맞는걸까용?Adela
Autumn
className=""
를 혼용해서 써도 괜찮을지, 한 가지로 통일하는 게 좋은지 궁금합니다. 지난 프로젝트에서는 모든 태그를 다 Styled component로 썼었는데, 개인적인 느낌으로는 컴포넌트가 너무 많은 것 같기도 하고 Styled component 안에서 중첩해서 태그 또는 클래스이름을 넣을 수 있어서 굳이 다 styled component로 만들 필요가 있나 싶어서요!혼용해서 쓴 예시는 1b7f635 커밋 -> Card.jsx 에 있습니다.
현재까지 구상한 컴포넌트 구조
일감 나누기 스프레드 시트
👉 바로가기