Skip to content
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
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
28 changes: 24 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>판다 마켓</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>판다마켓</title>

<!--
Font preloading
- 페이지가 처음 로딩될 때 텍스트가 순간적으로 깜빡이거나 바뀌는 듯한 현상을 보신 적이 있으신가요? (Flash of Unstyled Text, FOUT)
브라우저가 지정된 폰트를 다운로드 받는 동안 임시로 대체 폰트("fallback font")를 사용하기 때문인데요, 폰트를 preload하면 텍스트 렌더링을 보다 매끄럽게 할 수 있습니다.
- 브라우저는 rel="preload"로 지정된 리소스를 우선적으로 준비합니다.
- 폰트, 페이지 상단의 이미지, 가장 먼저 실행되어야 하는 스크립트 등에 preload 속성을 사용하는 경우가 많아요.
- href의 리소스 유형에 따라 <link>의 `as` 속성값을 정해야 해요. 일반적인 폰트 파일(예: .woff, .ttf 등)이라면 as="font"겠지만, 우리가 사용하는 웹폰트는 css 형식이기 때문에 as="style"을 사용합니다.
-->
<link
rel="preload"
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css"
as="style"
onload="this.onload=null;this.rel='stylesheet'"
/>
<!-- 간혹 보안 등의 이슈로 자바스크립트를 지원하지 않는 브라우저 환경에서도 최소한의 스타일이 로딩될 수 있도록 합니다. -->
<noscript
><link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css"
/></noscript>
</head>
<body>
<div id="root"></div>
Expand Down
13 changes: 0 additions & 13 deletions src/Api.js

This file was deleted.

29 changes: 29 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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 (
<BrowserRouter>
{/* Global Navigation Bar */}
<Header />

<div className="withHeader">
<Routes>
{/* React Router v6부터는 path="/" 대신 간단하게 `index`라고 표기하면 돼요 */}
<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>
);
}

export default App;
27 changes: 0 additions & 27 deletions src/App.jsx

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 = {}) {
// URLSearchParams을 이용하면 파라미터 값을 자동으로 쉽게 인코딩할 수 있어요.
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.
Binary file added src/assets/images/icons/ic_X.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: 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.
43 changes: 0 additions & 43 deletions src/components/Header/Header.css

This file was deleted.

24 changes: 0 additions & 24 deletions src/components/Header/Header.jsx

This file was deleted.

14 changes: 0 additions & 14 deletions src/components/ItemList/ItemList.css

This file was deleted.

17 changes: 0 additions & 17 deletions src/components/ItemList/ItemList.jsx

This file was deleted.

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;
}
}
42 changes: 42 additions & 0 deletions src/components/Layout/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react";
import Logo from "../../assets/images/logo/logo.svg";
import { Link, NavLink } from "react-router-dom";
import "./Header.css";

// react-router-dom의 NavLink를 이용하면 활성화된 네비게이션 항목을 하이라이트해줄 수 있어요!
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
Loading