-
Notifications
You must be signed in to change notification settings - Fork 43
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
[최제원] Sprint6 #245
Merged
kich555
merged 11 commits into
codeit-bootcamp-frontend:React-최제원
from
CJewon:React-최제원-sprint6
Dec 4, 2024
The head ref may contain hidden characters: "React-\uCD5C\uC81C\uC6D0-sprint6"
Merged
[최제원] Sprint6 #245
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
db45b99
Revert "[최제원] Sprint4 (#155)"
CJewon 2fd73b2
react npm start 오류로 인한 npm install 및 react 개발환경 셋팅
CJewon 6c30b66
header 추가 및 GET 리퀘스트를 받아 itemList 정렬
CJewon 66f6832
클래스 이름 추가 및 CSS 추가
CJewon 9c47467
파일 구조 정리 및 상품 정렬 쿼리 생성
CJewon c7cb73c
최신순, 인기순 드롭아웃 html 구현과 검색 input 기능 html 구현
CJewon c8e22ef
form 태그 내부에 있는 태그들의 css 추가 및 수정
CJewon b4b9ce3
Merge branch 'React-최제원' of https://github.com/codeit-bootcamp-fronte…
CJewon 944208c
스프린트 미션5 미완성으로 코드잇에서 제공한 스프린트 미션5 완성본을 표본으로 커밋
CJewon 7104975
addItemPage html과 css 추가
CJewon 702b080
이미지 삭제 기능 추가
CJewon 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
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,13 +1,21 @@ | ||
import React from "react"; | ||
import "./Product.css"; | ||
import heartImg from "../../img/heartIcon.png"; | ||
|
||
export default function Products({ item }) { | ||
export default function Products({ item, layoutType }) { | ||
return ( | ||
<div className="product"> | ||
<img src={item.images} alt="제품 이미지" className="product-img" /> | ||
<img | ||
src={item.images} | ||
alt="제품 이미지" | ||
className={`product-img ${layoutType}`} | ||
/> | ||
<h2 className="product-name">{item.name}</h2> | ||
<p className="product-price">{item.price}</p> | ||
<p className="product-favoriteCount">{item.favoriteCount}</p> | ||
<div className="favorite-count__container"> | ||
<img src={heartImg} alt="하트이미지" className="favorite-count__img" /> | ||
<p className="product-favoriteCount">{item.favoriteCount}</p> | ||
</div> | ||
</div> | ||
); | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -2,11 +2,12 @@ import { useEffect, useState } from "react"; | |
import productList from "../../Api.js"; | ||
import ItemList from "../../components/ItemList/ItemList.jsx"; | ||
import "./Home.css"; | ||
import { Link } from "react-router-dom"; | ||
|
||
function Home() { | ||
const [allItems, setAllItems] = useState([]); | ||
const [bestItems, setBestItems] = useState([]); | ||
|
||
const [selectedOption, setSelectedOption] = useState("최신순"); | ||
const loadAllItems = async () => { | ||
try { | ||
const { list } = await productList({ orderBy: "recent" }); | ||
|
@@ -33,21 +34,38 @@ function Home() { | |
loadBestItems(); | ||
}, []); | ||
|
||
const handleSortClick = () => { | ||
setOrderBy((prevOrderBy) => | ||
prevOrderBy === "recent" ? "favorite" : "recent" | ||
); | ||
const handleOptionClick = (e) => { | ||
setSelectedOption(e.target.value); | ||
}; | ||
|
||
return ( | ||
<section className="products__section"> | ||
<section className="products-section"> | ||
<div className="favorite-products__container"> | ||
<h1>베스트 상품</h1> | ||
<h1 className="products-section__title--best">베스트 상품</h1> | ||
<ItemList items={bestItems} layoutType="flex"></ItemList> | ||
</div> | ||
<div className="all-products__container"> | ||
<div className=""></div> | ||
<h1>전체 상품</h1> | ||
<div className="all-products__header"> | ||
<h1 className="products-section__title--all">전체 상품</h1> | ||
<form className="all-products__search-container"> | ||
<input | ||
type="text" | ||
placeholder="검색할 상품을 입력해주세요" | ||
className="all-products__input" | ||
/> | ||
<Link to="/additem" className="all-products__add-button"> | ||
상품 등록하기 | ||
</Link> | ||
<select | ||
value={selectedOption} | ||
onChange={handleOptionClick} | ||
className="dropDown-products" | ||
> | ||
<option value="최신순">최신순</option> | ||
<option value="인기순">인기순</option> | ||
</select> | ||
</form> | ||
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. form에 submit 버튼이 없네요? |
||
</div> | ||
<ItemList items={allItems} layoutType="grid"></ItemList> | ||
</div> | ||
</section> | ||
|
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.
<Home></Home>
-><Home/>