Skip to content

Commit a7a56a2

Browse files
committed
navbar. useUrl이 작동은 되는데 에러 발생.
1 parent 7ea4495 commit a7a56a2

28 files changed

+5913
-93
lines changed

.github/pull-request-template.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/auto-label-assign.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

README.md

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,40 @@
1-
# 🐼 판다마켓 프로젝트
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/pages/api-reference/create-next-app).
22

3-
> _이 저장소는 판다마켓 프로젝트의 프론트엔드 코드를 관리하는 곳입니다. 프로젝트를 클론하여 개발 환경을 설정하고, 각 브랜치에서 해당 스프린트 미션을 수행해 주세요!_ 🛠️
3+
## Getting Started
44

5-
## 소개
5+
First, run the development server:
66

7-
안녕하세요! 판다마켓 프로젝트에 오신 것을 환영합니다! 🥳
8-
판다마켓은 따뜻한 중고거래를 위한 커뮤니티 플랫폼이에요. 여러분은 이곳에서 상품을 등록하고, 다른 사용자들과 소통하며, 자유롭게 이야기를 나눌 수 있어요. 매주 스프린트 미션을 통해 기능을 하나씩 만들어 가며 성장해 나가는 여정을 함께해요. 🚀
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
916

10-
![PandaMarket](https://github.com/user-attachments/assets/3784b99f-73c9-4349-a9a9-92b2a7563574)
11-
_위 이미지는 판다마켓의 대표 이미지입니다._ 📸
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
1218

13-
## 스프린트 미션이란? 🤔
19+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
1420

15-
스프린트 미션은 **하나의 개인 프로젝트를 길게 진행하면서, 그 과정에서 주기적으로 피드백을 받을 수 있는 시스템**이에요. 각 스프린트마다 배운 이론을 적용해 보고, **멘토님께 코드 리뷰를 받아가며 실력을 쑥쑥 키워갈 수 있는 중요한 개인 과제**랍니다. 💪
21+
[API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
1622

17-
## 주요 기능 ✨
23+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) instead of React pages.
1824

19-
1. **상품 등록**: 내가 가진 물건을 올리고, 사진과 설명을 추가해 직접 판매할 수 있어요!
20-
2. **문의 댓글**: 상품에 대한 궁금한 점이나 의견을 자유롭게 남길 수 있답니다. 📝
21-
3. **자유게시판**: 다양한 주제로 친구들과 이야기를 나누고, 정보를 공유할 수 있는 공간이에요! 🗣️
25+
This project uses [`next/font`](https://nextjs.org/docs/pages/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
2226

23-
## 프로젝트 브랜치 구조 🏗️
27+
## Learn More
2428

25-
프로젝트는 단계별로 나뉘어 있고, 각 스프린트 미션에 맞는 브랜치가 있어요. 각 브랜치를 통해 체계적으로 개발하며 학습할 수 있어요. 🎯
29+
To learn more about Next.js, take a look at the following resources:
2630

27-
### 브랜치 설명
31+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
32+
- [Learn Next.js](https://nextjs.org/learn-pages-router) - an interactive Next.js tutorial.
2833

29-
1. **basic (part1): 스프린트 미션 1 ~ 4 FE 요구사항**
34+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
3035

31-
- 기본적인 웹 애플리케이션 기능 구현을 위한 초기 브랜치입니다. HTML, CSS, JavaScript 등을 사용해 기본을 다집니다.
32-
- **스프린트 미션 1부터 4까지**의 프론트엔드 내용을 포함하고 있어요.
36+
## Deploy on Vercel
3337

34-
2. **react (part2): 스프린트 미션 5 ~ 7 FE 요구사항**
38+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
3539

36-
- React 라이브러리를 사용해 프론트엔드 기능을 구현하는 브랜치입니다. 컴포넌트 기반 아키텍처와 상태 관리를 배웁니다.
37-
- **스프린트 미션 5부터 7까지, 그 이후**의 프론트엔드 내용을 포함하고 있어요.
38-
- 만약 스프린트 미션 9부터 프론트엔드 코드를 Next가 아닌 React로 구현하고 싶다면 react 브랜치를 사용해요.
39-
40-
3. **next (part3,4): 스프린트 미션 8 FE 요구사항~**
41-
42-
- Next.js를 사용해 서버 사이드 렌더링(SSR)과 정적 사이트 생성(SSG) 등 고급 기능을 구현합니다.
43-
- **스프린트 미션 8부터** 시작하는 프론트엔드 내용을 포함하고 있어요.
44-
- 만약 스프린트 미션 9부터 프론트엔드 코드를 React가 아닌 Next로 구현하고 싶다면 next 브랜치를 사용해요.
45-
46-
> _스프린트 미션 내 백엔드 요구사항은 [백엔드 레포지토리](https://github.com/codeit-sprint-fullstack/7-sprint-mission-be)의 브랜치에서 관리해주세요_
47-
48-
---
49-
50-
본 프로젝트는 [코드잇](https://www.codeit.kr)의 소유이며, 교육 목적으로만 사용됩니다. © 2024 Codeit. All rights reserved.
40+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/pages/building-your-application/deploying) for more details.

assets/panda-logo.svg

Lines changed: 14 additions & 0 deletions
Loading

components/Navbar.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import PandaLogo from "../assets/panda-logo.svg";
2+
import Image from "next/image";
3+
import styles from "./Navbar.module.css";
4+
import Link from "next/link";
5+
import { useUrl } from "@/lib/UrlContext";
6+
7+
function PageLink({ link, text }) {
8+
const { url } = useUrl();
9+
10+
return (
11+
<div
12+
className={`${styles.pageLink} ${link === url ? styles.blueText : ""}`}
13+
>
14+
<Link href={link}>{text}</Link>
15+
</div>
16+
);
17+
}
18+
19+
export default function Navbar() {
20+
return (
21+
<header className={styles.header}>
22+
<div className={styles.headerBox}>
23+
<div className={`${styles.landingLink} ${styles.Link}`}>
24+
<Link href="/" className={styles.IconLink}>
25+
<Image
26+
className={styles.logoIcon}
27+
src={PandaLogo}
28+
alt="판다 로고 아이콘"
29+
/>
30+
</Link>
31+
<h1 className={styles.logoTitle}>
32+
<Link href="/">판다마켓</Link>
33+
</h1>
34+
</div>
35+
<div className={`${styles.pagesLink} ${styles.Link}`}>
36+
<PageLink link="/article" text={"자유게시판"} />
37+
<PageLink link="/items" text={"중고마켓"} />
38+
</div>
39+
<div className={styles.loginLink}>
40+
<Link href="/login"> 로그인</Link>
41+
</div>
42+
</div>
43+
</header>
44+
);
45+
}

components/Navbar.module.css

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.header {
2+
padding: 0 200px;
3+
position: fixed;
4+
top: 0;
5+
border-bottom: 1px solid #dfdfdf;
6+
background: #fff;
7+
height: 70px;
8+
width: 100%;
9+
z-index: 1;
10+
}
11+
12+
.headerBox {
13+
width: 100%;
14+
height: 100%;
15+
display: flex;
16+
align-items: center;
17+
gap: 32px;
18+
}
19+
20+
.Link {
21+
display: flex;
22+
flex-direction: row;
23+
align-items: center;
24+
}
25+
26+
.landingLink {
27+
width: 153px;
28+
height: 51px;
29+
justify-content: space-between;
30+
}
31+
32+
.IconLink {
33+
width: 40px;
34+
height: 40px;
35+
}
36+
37+
.logoIcon {
38+
width: 100%;
39+
height: 100%;
40+
}
41+
42+
.logoTitle {
43+
color: var(--brand-blue, #3692ff);
44+
font-family: "ROKAF Sans";
45+
font-size: 25.633px;
46+
font-style: normal;
47+
font-weight: 700;
48+
line-height: normal;
49+
}
50+
51+
.pagesLink {
52+
flex-grow: 1;
53+
}
54+
55+
.pageLink {
56+
display: flex;
57+
width: 109px;
58+
height: 69px;
59+
display: flex;
60+
justify-content: center;
61+
align-items: center;
62+
63+
text-align: center;
64+
font-family: Pretendard;
65+
font-size: 18px;
66+
font-style: normal;
67+
font-weight: 700;
68+
line-height: normal;
69+
}
70+
71+
.loginLink {
72+
width: 128px;
73+
height: 48px;
74+
padding: 12px 23px;
75+
text-align: center;
76+
border: none;
77+
border-radius: 8px;
78+
color: #ffffff;
79+
font-size: 16px;
80+
background: var(--Primary-100, #3692ff);
81+
flex-shrink: 0;
82+
}
83+
84+
.blueText {
85+
color: var(--brand-blue, #3692ff);
86+
}

eslint.config.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
});
11+
12+
const eslintConfig = [...compat.extends("next/core-web-vitals")];
13+
14+
export default eslintConfig;

jsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"paths": {
4+
"@/*": ["./*"]
5+
}
6+
}
7+
}

lib/UrlContext.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { useRouter } from "next/router";
2+
import { createContext, useContext, useState } from "react";
3+
4+
export const UrlContext = createContext();
5+
6+
export function UrlProvider({ children }) {
7+
const [url, setUrl] = useState("/");
8+
9+
return (
10+
<UrlContext.Provider value={{ url, setUrl }}>
11+
{children}
12+
</UrlContext.Provider>
13+
);
14+
}
15+
16+
export function useUrl() {
17+
const urlContext = useContext(UrlContext);
18+
19+
if (!urlContext) {
20+
throw new Error("urlContext 안에서 써야 합니다");
21+
}
22+
23+
return urlContext;
24+
}
25+
26+
export function setPageUrl() {
27+
const router = useRouter();
28+
const { setUrl } = useUrl();
29+
setUrl(router.pathname);
30+
}

0 commit comments

Comments
 (0)