Skip to content

Commit

Permalink
First commit Sprint Mission5 on React (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
joodongkim authored Sep 9, 2024
1 parent 66f3ba6 commit d48b01a
Show file tree
Hide file tree
Showing 46 changed files with 6,680 additions and 4,560 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
10,137 changes: 5,749 additions & 4,388 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "1-weekly-mission",
"name": "fe10-sprint-mission5",
"version": "0.1.0",
"private": true,
"dependencies": {
Expand All @@ -8,6 +8,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
Expand Down
39 changes: 39 additions & 0 deletions package.json.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "panda-market-react",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file modified public/favicon.ico
Binary file not shown.
47 changes: 11 additions & 36 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<html lang="ko">
<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="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/
-->
<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>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="keywords" content="Codeit - FE10 Sprint Mission 5">
<meta name="author" content="[email protected]">
<meta property="og:type" content="website" />
<meta property="og:title" content="판다마켓" />
<meta property="og:description" content="일상의 모든 물건을 거래해 보세요" />
<meta property="og:image" content="/og-image.png" />
<meta property="og:url" content="" />
<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.

Binary file added public/og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

37 changes: 19 additions & 18 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import logo from './logo.svg';
import './App.css';
import { BrowserRouter, Route, Routes } from "react-router-dom";
import HomePage from "./pages/HomePage/HomePage";
import LoginPage from "./pages/LoginPage/LoginPage";
import MarketPage from "./pages/MarketPage/MarketPage";
import AddItemPage from "./pages/AddItemPage/AddItemPage";
import CommunityFeedPage from "./pages/CommunityFeedPage/CommunityFeedPage";
import Header from "./components/Layout/Header";

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
<BrowserRouter>
<Header />
<div className="withHeader">
<Routes>
<Route index element={<HomePage />} />
<Route path="login" element={<LoginPage />} />
<Route path="items" element={<MarketPage />} />
<Route path="additem" element={<AddItemPage />} />
<Route path="community" element={<CommunityFeedPage />} />
</Routes>
</div>
</BrowserRouter>
);
}

Expand Down
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

18 changes: 18 additions & 0 deletions src/api/itemApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export async function getProducts(params = {}) {
// Using URLSearchParams allows for easy automatic encoding of parameter values.
const query = new URLSearchParams(params).toString();

try {
const response = await fetch(
`https://panda-market-api.vercel.app/products?${query}`
);
if (!response.ok) {
throw new Error(`HTTP error: ${response.status}`);
}
const body = await response.json();
return body;
} catch (error) {
console.error("Failed to fetch products:", error);
throw error;
}
}
3 changes: 3 additions & 0 deletions src/assets/images/icons/arrow_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/images/icons/arrow_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/images/icons/ic_heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/images/icons/ic_search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/icons/ic_sort.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/assets/images/logo/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions src/components/Layout/Header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.headerLeft {
display: flex;
align-items: center;
}

.headerLogo {
margin-right: 16px;
}

.globalHeader nav ul {
display: flex;
list-style: none;
gap: 8px;
font-weight: bold;
font-size: 16px;
color: #4b5563;
}

.globalHeader nav ul li a:hover {
color: var(--blue);
}

.loginLink {
font-size: 16px;
font-weight: 600;
border-radius: 8px;
padding: 11.5px 23px;
}

@media (min-width: 768px) {
.globalHeader nav ul {
gap: 36px;
font-size: 18px;
}

.headerLogo {
margin-right: 35px;
}
}

@media (min-width: 1280px) {
.headerLogo {
margin-right: 47px;
}
}
41 changes: 41 additions & 0 deletions src/components/Layout/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react'
import Logo from '../../assets/images/logo/logo.svg'
import { Link, NavLink } from 'react-router-dom'
import './Header.css'

function getLinkStyle ({ isActive }) {
return { color: isActive ? 'var(--blue)' : undefined }
}

function Header () {
return (
<header className='globalHeader'>
<div className='headerLeft'>
<Link to='/' className='headerLogo' aria-label='홈으로 이동'>
<img src={Logo} alt='판다마켓 로고' width='153' />
</Link>

<nav>
<ul>
<li>
<NavLink to='/community' style={getLinkStyle}>
자유게시판
</NavLink>
</li>
<li>
<NavLink to='/items' style={getLinkStyle}>
중고마켓
</NavLink>
</li>
</ul>
</nav>
</div>

<Link to='/login' className='loginLink button'>
로그인
</Link>
</header>
)
}

export default Header
Loading

0 comments on commit d48b01a

Please sign in to comment.