Skip to content

Commit 5f20228

Browse files
authored
navBar style change (#15)
1 parent 76fa639 commit 5f20228

File tree

6 files changed

+110
-73
lines changed

6 files changed

+110
-73
lines changed

src/components/BottomNav/BottomNav.css

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

src/components/BottomNav/index.tsx

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

src/components/NavBar/index.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { FaComment, FaPlus, FaSearch, FaUser } from 'react-icons/fa';
2+
import { Link, useLocation } from 'react-router-dom';
3+
import './navBar.css';
4+
5+
const NavBar = () => {
6+
const location = useLocation();
7+
8+
const navLinks = [
9+
{ path: '/search-room', icon: <FaSearch />, label: 'roomSearch' },
10+
{ path: '/create-room', icon: <FaPlus />, label: 'roomCreate' },
11+
{ path: '/my-chat', icon: <FaComment />, label: 'myChat' },
12+
{ path: '/my-page', icon: <FaUser />, label: 'myPage' },
13+
];
14+
15+
return (
16+
<nav className="navBar">
17+
<div className="logo">
18+
<Link to="/">
19+
<img src="/snuxi-logo.png" alt="SNUXI Logo" />
20+
</Link>
21+
</div>
22+
<div className="nav-links">
23+
{navLinks.map(({ path, icon, label }) => (
24+
<Link
25+
key={path}
26+
to={path}
27+
className={`nav-item ${location.pathname === path ? 'active' : ''}`}
28+
>
29+
<div className="icon">{icon}</div>
30+
<div className="label">{label}</div>
31+
</Link>
32+
))}
33+
</div>
34+
<div className="login">
35+
<Link to="/login" className="login-button">
36+
로그인
37+
</Link>
38+
</div>
39+
</nav>
40+
);
41+
};
42+
43+
export default NavBar;

src/components/NavBar/navBar.css

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.navBar {
2+
display: flex;
3+
justify-content: space-between;
4+
align-items: center;
5+
height: 60px;
6+
width: 100%;
7+
background-color: #ffffff;
8+
border-bottom: 1px solid #e0e0e0;
9+
padding: 0 20px;
10+
box-sizing: border-box;
11+
position: sticky;
12+
top: 0;
13+
z-index: 1000;
14+
}
15+
16+
.logo {
17+
width: 80px;
18+
}
19+
20+
.logo img {
21+
height: 40px;
22+
}
23+
24+
.nav-links {
25+
display: flex;
26+
justify-content: center;
27+
align-items: center;
28+
gap: 20px;
29+
flex-grow: 1;
30+
}
31+
32+
.nav-item {
33+
display: flex;
34+
flex-direction: column;
35+
align-items: center;
36+
text-decoration: none;
37+
color: #333;
38+
}
39+
40+
.nav-item.active {
41+
color: #007bff;
42+
}
43+
44+
.icon {
45+
font-size: 24px;
46+
}
47+
48+
.label {
49+
font-size: 12px;
50+
}
51+
52+
.login {
53+
width: 80px;
54+
text-align: right;
55+
}
56+
57+
.login-button {
58+
color: #333;
59+
text-decoration: none;
60+
}

src/router/MainLayout.css

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
.main-layout {
2-
display: flex;
3-
flex-direction: column;
4-
height: 100vh;
5-
}
6-
7-
.main-content {
8-
flex-grow: 1;
9-
overflow-y: auto;
1+
.main-container {
2+
padding-top: 60px; /* Same as the height of the navBar */
103
}

src/router/Router.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BrowserRouter, Outlet, Route, Routes } from 'react-router-dom';
2-
import BottomNav from '../components/BottomNav';
2+
import NavBar from '../components/NavBar';
33
import CreateRoom from '../pages/CreateRoom';
44
import Login from '../pages/Login';
55
import MyChat from '../pages/MyChat';
@@ -9,12 +9,12 @@ import './MainLayout.css';
99

1010
const MainLayout = () => {
1111
return (
12-
<div className="main-layout">
13-
<div className="main-content">
12+
<>
13+
<NavBar />
14+
<div className="main-container">
1415
<Outlet />
1516
</div>
16-
<BottomNav />
17-
</div>
17+
</>
1818
);
1919
};
2020

0 commit comments

Comments
 (0)