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
91 changes: 62 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@types/react": "^19.0.3",
"@types/react-dom": "^19.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.28.0",
"react-scripts": "5.0.1",
"typescript": "^5.7.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

typescript 및 @types 라이브러리들은 프로덕션에 필요한게 아니라 빌드할 때만 필요해서
devDependencies로 변경해주시면 좋을 것 같아요.

"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
8 changes: 6 additions & 2 deletions src/App.js → src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { BrowserRouter, Route, Routes } from "react-router-dom";
import Header from "./component/Navigation/Header";
import MainPage from "./pages/MainPage";
import UsedMarketPage from "./pages/UsedMarketPage";
import PostProductPage from "./pages/PostProductPage";
import ProductDetail from "./pages/ProductDetail";
import "./styles/global.css";

function App() {
return (
<BrowserRouter>
<Header />
<Routes>
<Route path="/" element={<MainPage />} />
<Route path="/items" element={<UsedMarketPage />} />
<Route path="/items">
<Route index element={<MainPage />} />
<Route path=":productSlug" element={<ProductDetail />} />
</Route>
<Route path="/additem" element={<PostProductPage />} />
</Routes>
</BrowserRouter>
Expand Down
20 changes: 0 additions & 20 deletions src/api.js

This file was deleted.

50 changes: 50 additions & 0 deletions src/api.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
interface Product {
page?: number;
pageSize: number;
orderBy: string;
keyword?: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

인터페이스의 값들이 query parameter들로 보이는데 ProductQueryParams 같이 이름으로 어떤 값들이 있는지 예상가능한 타입 이름이면 좋을 것 같아요.


interface Comment {
productSlug: string;
limit: number;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

위 내용과 같은 맥락에서 적절한 이름으로 수정해보시면 좋을 것 같아요.


export async function getProduct({
page = 1,
pageSize = 4,
orderBy = "favorite",
keyword = "",
}: Product) {
Copy link
Contributor

Choose a reason for hiding this comment

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

함수의 return 타입도 명시하면 함수를 사용하는 곳에서 어떤 타입의 값을 받게 되는지 알 수 있어 좋을 것 같아요.

//기본 URL
const baseURL = "https://panda-market-api.vercel.app/products";
//URL 객체
const url = new URL(baseURL);
url.searchParams.set("page", page.toString());
url.searchParams.set("pageSize", pageSize.toString());
url.searchParams.set("orderBy", orderBy);
url.searchParams.set("keyword", keyword);
//API 호출
console.log(url.toString());
const response = await fetch(url.toString());
const data = await response.json();
return data;
}

//제품 상세페이지
export async function getProductDetail(productSlug: string) {
const response = await fetch(
`https://panda-market-api.vercel.app/products/${productSlug}`
);
const data = await response.json();
return data;
}

//제품 코멘트
export async function getProductComment({ productSlug, limit }: Comment) {
const response = await fetch(
`https://panda-market-api.vercel.app/products/${productSlug}/comments?limit=${limit}`
);
const data = await response.json();
return data;
}
Binary file added src/asset/Img_inquiry_empty.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/asset/fdec874e30ff90436580b2b8d751e9f5.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/asset/ic_back.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/asset/ic_kebab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 0 additions & 36 deletions src/component/AllProduct/AllProductItem.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@
margin: 0;
}

.allproduct-img {
.allproduct_img {
width: 221px;
height: 221px;
border-radius: 16px;
object-fit: cover;
}

.allproduct-popularity {
.allproduct_popularity {
width: 16px;
height: 16px;
color: black;
}

.allproduct-title {
.allproduct_title {
font-size: 14px;
font-weight: 500;
color: black;
}

.link {
text-decoration: none;
color: black;
}
Loading
Loading