Skip to content

Commit 91c24e8

Browse files
authored
Feat: 경로 상수화 및 nav 컴포넌트 네이밍 수정 (#68)
1 parent 383186e commit 91c24e8

7 files changed

Lines changed: 24 additions & 18 deletions

File tree

app/(main)/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ReactNode } from "react";
22

3-
import NavHome from "@/shared/ui/nav-home/nav-home";
3+
import NavbarMain from "@/shared/ui/navbar/navbar-main/navbar-main";
44

55
export default function MainLayout({
66
children,
@@ -9,7 +9,7 @@ export default function MainLayout({
99
}) {
1010
return (
1111
<div>
12-
<NavHome />
12+
<NavbarMain />
1313
{children}
1414
</div>
1515
);
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const My = () => {
1+
const MyCapsule = () => {
22
return (
33
<div>
44
<h1>my</h1>
55
</div>
66
);
77
};
88

9-
export default My;
9+
export default MyCapsule;

app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import NavHome from "@/shared/ui/nav-home/nav-home";
1+
import NavbarMain from "@/shared/ui/navbar/navbar-main/navbar-main";
22

33
const Home = () => {
44
return (
55
<div>
6-
<NavHome />
6+
<NavbarMain />
77
<main>
88
<h1>Home</h1>
99
</main>

shared/constants/.gitkeep

Whitespace-only changes.

shared/constants/path.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const PATH = {
2+
// Main
3+
HOME: "/",
4+
EXPLORE: "/explore",
5+
MY_CAPSULE: "/my-capsule",
6+
SETTING: "/setting",
7+
} as const;
File renamed without changes.

shared/ui/nav-home/nav-home.tsx renamed to shared/ui/navbar/navbar-main/navbar-main.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"use client";
22

33
import SearchIcon from "@/shared/assets/svgs/search.svg";
4+
import { PATH } from "@/shared/constants/path";
45
import { cn } from "@/shared/utils/cn";
56
import Link from "next/link";
6-
77
import { useState } from "react";
8-
import HamburgerMenuButton from "../hamburger-menu-button/hamburger-menu-button";
9-
import * as styles from "./nav-home.css";
8+
import HamburgerMenuButton from "../../hamburger-menu-button/hamburger-menu-button";
9+
import * as styles from "./navbar-main.css";
1010

11-
const NavHome = () => {
11+
const NavbarMain = () => {
1212
const [isMenuOpen, setIsMenuOpen] = useState(false);
1313

1414
const handleMenuClick = () => {
@@ -23,22 +23,21 @@ const NavHome = () => {
2323
isMenuOpen ? styles.navHomeStyleOpen : "",
2424
)}
2525
>
26-
{/* 데스크탑 메뉴 목록 */}
2726
<div>logo</div>
2827
<div className={styles.navWrapper}>
2928
<ul className={styles.navList}>
3029
<li>
31-
<Link href="/explore" className={styles.buttonStyle}>
30+
<Link href={PATH.EXPLORE} className={styles.buttonStyle}>
3231
탐색
3332
</Link>
3433
</li>
3534
<li>
36-
<Link href="/my" className={styles.buttonStyle}>
35+
<Link href={PATH.MY_CAPSULE} className={styles.buttonStyle}>
3736
내 캡슐
3837
</Link>
3938
</li>
4039
<li>
41-
<Link href="/setting" className={styles.buttonStyle}>
40+
<Link href={PATH.SETTING} className={styles.buttonStyle}>
4241
설정
4342
</Link>
4443
</li>
@@ -62,7 +61,7 @@ const NavHome = () => {
6261
>
6362
<li>
6463
<Link
65-
href="/explore"
64+
href={PATH.EXPLORE}
6665
className={styles.menuItem}
6766
onClick={handleMenuClick}
6867
>
@@ -71,7 +70,7 @@ const NavHome = () => {
7170
</li>
7271
<li>
7372
<Link
74-
href="/my"
73+
href={PATH.MY_CAPSULE}
7574
className={styles.menuItem}
7675
onClick={handleMenuClick}
7776
>
@@ -80,7 +79,7 @@ const NavHome = () => {
8079
</li>
8180
<li>
8281
<Link
83-
href="/setting"
82+
href={PATH.SETTING}
8483
className={styles.menuItem}
8584
onClick={handleMenuClick}
8685
>
@@ -92,4 +91,4 @@ const NavHome = () => {
9291
);
9392
};
9493

95-
export default NavHome;
94+
export default NavbarMain;

0 commit comments

Comments
 (0)