Skip to content

Commit efdb8c9

Browse files
committed
feat: 사이드바 구현
1 parent b42e1bc commit efdb8c9

3 files changed

Lines changed: 76 additions & 1 deletion

File tree

components/common/Sidebar.tsx

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,69 @@
1+
'use client';
2+
3+
import Link from 'next/link';
4+
import { usePathname } from 'next/navigation';
5+
import {
6+
Home,
7+
ClipboardList,
8+
CalendarPlus,
9+
CopyPlus,
10+
LogOut,
11+
} from 'lucide-react';
12+
13+
const navItems = [
14+
{ label: '홈', href: '/', icon: Home },
15+
{ label: '개발 일지', href: '/logs', icon: ClipboardList },
16+
{ label: '새 계획 만들기', href: '/plans/new', icon: CalendarPlus },
17+
{ label: '새 페이지 만들기', href: '/pages/new', icon: CopyPlus },
18+
];
19+
120
const Sidebar = () => {
2-
return <div className="w-48 bg-white"></div>;
21+
const pathname = usePathname();
22+
23+
return (
24+
<div className="fixed flex h-screen w-48 flex-col bg-white">
25+
<div className="flex items-center gap-2 px-6 py-5">
26+
<span className="text-primary text-lg font-bold">&lt;/&gt;</span>
27+
<span>DevFlow</span>
28+
</div>
29+
<hr className="border-slate-300" />
30+
<nav className="mt-4 px-4">
31+
<ul className="space-y-2">
32+
{navItems.map(({ label, href, icon: Icon }) => {
33+
const isActive = pathname === href;
34+
35+
return (
36+
<li key={href}>
37+
<Link
38+
href={href}
39+
className={[
40+
'flex items-center gap-3 rounded-lg px-4 py-3 text-sm font-medium transition',
41+
isActive
42+
? 'bg-slate-200 text-slate-900'
43+
: 'text-slate-700 hover:bg-slate-100',
44+
].join(' ')}
45+
>
46+
<Icon
47+
className={[
48+
'h-5 w-5',
49+
isActive ? 'text-slate-900' : 'text-slate-600',
50+
].join(' ')}
51+
/>
52+
{label}
53+
</Link>
54+
</li>
55+
);
56+
})}
57+
</ul>
58+
</nav>
59+
<div className="absolute bottom-0 w-full border-t border-slate-200 p-4">
60+
<button className="flex items-center gap-3 rounded-lg px-4 py-3 text-sm font-medium text-slate-700 hover:bg-slate-100">
61+
<LogOut className="h-5 w-5 text-slate-600" />
62+
로그아웃
63+
</button>
64+
</div>
65+
</div>
66+
);
367
};
468

569
export default Sidebar;

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dependencies": {
1212
"clsx": "^2.1.1",
1313
"firebase": "^12.7.0",
14+
"lucide-react": "^0.562.0",
1415
"next": "16.1.1",
1516
"react": "19.2.3",
1617
"react-dom": "19.2.3",

0 commit comments

Comments
 (0)