Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import FreeBoard from './components/pages/FreeBoard';
import Items from './components/pages/Items';
import { Route, Routes } from "react-router";
import AddItem from './components/pages/AddItem';
import ItemDetail from './components/pages/itemDetail/itemDetail';

function App() {

Expand All @@ -20,6 +21,7 @@ function App() {
<Route path="/freeBoard" element={<FreeBoard />} />
<Route path="/items" element={<Items />} />
<Route path="/additems" element={<AddItem />} />
<Route path="/items/:productId" element={<ItemDetail />} />
</Routes>
</>
)
Expand Down
23 changes: 23 additions & 0 deletions src/api/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,26 @@ export async function getItems({ page=1, pageSize=100, orderBy="recent"}) {
return body;
}

//productId 받아오는 api
export async function getItemId(productsId) {
const response = await fetch(`https://panda-market-api.vercel.app/products/${productsId}`)

if (!response.ok) {
throw new Error(`error 상태 ${response.status}`)
}

const body = await response.json();
return body
}

export async function getProductComments(productId, limit=10) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

❗️ 수정요청
지금은 고정값으로 코멘트를 불러오고 있어요~
모든 코멘트가 보이도록 무한스크롤 방식으로 구현해주시면 좋겠습니다!

const response = await fetch(`https://panda-market-api.vercel.app/products/${productId}/comments?limit=${limit}`)

if (!response.ok) {

throw new Error(`error 상태 ${response.status}`)
}
const body = await response.json();
return body.list;
}

Binary file added src/assets/backIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/kebabIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/noCommentImg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/components/AllItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
header,
title,
itemGrid,
itemLinkStyle,
pagenation
} from "./AllitemsStyle";
import ItemList from "./ItemList";
Expand All @@ -21,7 +22,6 @@ const AllItems = ({ items, onChangeOrder }) => {
<input placeholder="🔎 검색할 상품을 입력해주세요"></input>
<Link to={"/additems"}>
상품 등록하기
{/* <button >상품 등록하기</button> */}
</Link>
<select onChange={(e)=> onChangeOrder(e.target.value)}>
<option value={"recent"}>최신순</option>
Expand All @@ -32,7 +32,9 @@ const AllItems = ({ items, onChangeOrder }) => {
<div css={itemGrid} >
{items.map((item) => {
return(
<ItemList key={item.id} item={item} />
<Link to={`/Items/${item.id}`} css={itemLinkStyle} >
<ItemList key={item.id} item={item} />
Comment on lines +35 to +36
Copy link
Collaborator

Choose a reason for hiding this comment

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

❗️ 수정요청

Suggested change
<Link to={`/Items/${item.id}`} css={itemLinkStyle} >
<ItemList key={item.id} item={item} />
<Link key={item.id} to={`/Items/${item.id}`} css={itemLinkStyle} >
<ItemList item={item} />

</Link>
)
})}
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/components/AllitemsStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ const itemGrid = css`
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
`

const itemLinkStyle = css`
text-decoration: none;
`

const pagenation = css`
display: flex;
justify-content: center;
Expand All @@ -117,5 +121,6 @@ export {
header,
title,
itemGrid,
itemLinkStyle,
pagenation,
}
10 changes: 8 additions & 2 deletions src/components/BestItem.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Link } from "react-router-dom";
import {
constainer,
title,
itemGrid,
linkStyle,
} from "./BestItemStyle";
import ItemList from "./ItemList";

Expand All @@ -18,8 +20,12 @@ const BestItem = ({ items }) => {

<div css={itemGrid} >
{bestItems.map((item) => {
return <ItemList key={item.id} item={item}/>
})}
return (
<Link to={`${item.id}`} css={linkStyle}>
<ItemList key={item.id} item={item}/>
Comment on lines +24 to +25
Copy link
Collaborator

Choose a reason for hiding this comment

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

❗️ 수정요청

Suggested change
<Link to={`${item.id}`} css={linkStyle}>
<ItemList key={item.id} item={item}/>
<Link key={item.id} to={`${item.id}`} css={linkStyle}>
<ItemList item={item}/>

</Link>
)
})}
</div>
</div>
)
Expand Down
6 changes: 6 additions & 0 deletions src/components/BestItemStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ const itemGrid = css`

`

const linkStyle = css`
text-decoration: none;
`


export {
constainer,
title,
itemGrid,
linkStyle,
}
4 changes: 3 additions & 1 deletion src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const Header = () => {
<Link to={"/FreeBoard"} css={aTag}>자유게시판</Link>
<Link to={"/Items"}
css={[aTag,
(location.pathname ==='/Items' || location.pathname === '/additems') && css`
(location.pathname ==='/Items' ||
location.pathname.startsWith('/Items/') ||
location.pathname === '/additems' ) && css`
color: var(--blue)`]}
>
중고마켓
Expand Down
5 changes: 5 additions & 0 deletions src/components/ItemListStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { css } from "@emotion/react"

const itemListStyle = css`
width: 100%;
transition: all 0.2s ease;

&:hover {
transform: scale(1.05);
}

`

Expand Down
6 changes: 3 additions & 3 deletions src/components/pages/AddItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ const AddItem = () => {
</div>

<div>
<label>상품 소개</label>
<label htmlFor='description'>상품 소개</label>
<textarea id="description" placeholder="상품 소개를 입력해주세요" value={itemDescription} onChange={(e) => setItemDiscription(e.target.value)}></textarea>
</div>

<div>
<label>판매가격</label>
<label htmlFor='price'>판매가격</label>
<input id="price" placeholder="판매가격을 입력해주세요" type='number' value={itemPrice} onChange={(e) => setItemPrice(e.target.value)}></input>
</div>

<div>
<label>태그</label>
<label htmlFor='tag'>태그</label>
<input
id="tag"
placeholder="태그를 입력해주세요"
Expand Down
Loading
Loading