Skip to content
Closed
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
766 changes: 696 additions & 70 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.9.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^7.5.3",
"react-scripts": "5.0.1",
"resolve-url-loader": "^5.0.0",
"sass": "^1.87.0",
"scss": "^0.2.4",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
36 changes: 7 additions & 29 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,20 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
<link
rel="stylesheet"
as="style"
crossorigin
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<meta name="description" content="panda market" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>판다마켓</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

22 changes: 22 additions & 0 deletions src/API/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import axios from "axios";

export const api = axios.create({
baseURL: "https://panda-market-api.vercel.app",
headers: { "Content-Type": "application/json" },
timeout: 5000,
});

api.interceptors.response.use(
(res) => res,
(error) => {
const status = error.response?.status;
if (status === 404) {
alert("요청한 자원을 찾을 수 없습니다.");
} else if (status === 500) {
alert("서버에 문제가 발생했습니다.");
} else {
alert("문제가 발생했습니다.");
}
return Promise.reject(error);
}
);
7 changes: 7 additions & 0 deletions src/API/getItems.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { api } from "./api";
export default async function getItems(page = 1, pageSize = 60, sort = "") {
const res = await api.get(
`/products?page=${page}&pageSize=${pageSize}&orderBy=${sort}`
);
return res.data;
}
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

25 changes: 0 additions & 25 deletions src/App.js

This file was deleted.

20 changes: 20 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Route, Routes } from "react-router";
import AddItem from "./components/AddItem/AddItem";
import Nav from "./common/Nav/Nav";
import Items from "./components/Items/Items";
import Products from "./components/Products/Products";

export default function App() {
return (
<>
<Nav />
<Routes>
<Route path="/" element={<AddItem />} />

<Route path="/items" element={<Items />} />
<Route path="/products" element={<Products />} />
<Route path="/additem" element={<AddItem />} />
</Routes>
</>
);
}
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

46 changes: 46 additions & 0 deletions src/common/Nav/Nav.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import pandaMarket from "../../image/pandaMarket.svg";
import pandaFace from "../../image/pandaFace.svg";
import blankProfile from "../../image/blankProfile.svg";
import styles from "./Nav.module.scss";
import { useLocation, useNavigate } from "react-router";

export default function Nav() {
const navigate = useNavigate();
const locate = useLocation();
const location = locate.pathname;
return (
<nav>
<div className={styles["nav--left"]}>
<div className={styles.logo} onClick={() => navigate("/")}>
<img
src={pandaFace}
className={styles.pandaface}
alt="panda face"
></img>
<img
src={pandaMarket}
className={styles.pandamarket}
alt="panda market"
></img>
</div>
<div className={styles.menu}>
<span>자유게시판</span>
<span
onClick={() => navigate("/items")}
style={
location === "/items" || "/additems" ? { color: "#3692FF" } : {}
}
>
중고마켓
</span>
</div>
</div>

<img
className={styles.profile}
src={blankProfile}
alt="blank profile"
></img>
</nav>
);
}
56 changes: 56 additions & 0 deletions src/common/Nav/Nav.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
nav {
display: flex;
padding: 10px 200px;
justify-content: space-between;
border-bottom: 1px solid #dfdfdf;
}
.nav--left {
display: flex;
align-items: center;
gap: 47px;
}

.logo {
display: flex;
gap: 8.6px;
}
.menu {
display: flex;
gap: 30px;
font-size: 18px;
font-weight: 700;
line-height: 26px;
color: #4b5563; //Secondary/600
}

.logo,
.menu,
.profile {
cursor: pointer;
}
@media (max-width: 744px) {
nav {
padding: 10px 24px;
}
.nav--left {
gap: 20px;
}
}
@media (max-width: 376px) {
nav {
padding: 15px 16px;
}
.nav--left {
gap: 8px;
}
.pandaface {
display: none;
}
.pandamarket {
width: 81px;
}
.menu {
gap: 8px;
font-size: 16px;
}
}
Loading
Loading