Skip to content

Commit 1d5f011

Browse files
committed
feat: 홈페이지 버튼 라우팅
1 parent 66f37ed commit 1d5f011

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

components/common/Sidebar.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ const navItems = [
1616
{ label: '홈', href: '/', icon: Home },
1717
{ label: '개발 일지', href: '/logs', icon: ClipboardList },
1818
{ label: '계획 관리', href: '/plans/new', icon: CalendarPlus },
19-
{ label: '새 페이지 만들기', href: '/pages/new', icon: CopyPlus },
20-
]
21-
19+
{ label: '새 페이지 만들기', href: '/write', icon: CopyPlus },
20+
];
2221

2322
const Sidebar = () => {
2423
const pathname = usePathname();

components/home/ButtonSection.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
interface ButtonSectionProps {
2-
onAddTodo: (text: string) => void;
3-
}
1+
import { useRouter } from 'next/navigation';
42

5-
const ButtonSection = ({ onAddTodo }: ButtonSectionProps) => {
6-
const handleAddClick = () => {
7-
const text = prompt('할 일을 입력하세요');
8-
if (text) {
9-
onAddTodo(text);
10-
}
3+
const ButtonSection = () => {
4+
const router = useRouter();
5+
const handleNewPlan = () => {
6+
router.push('/plans');
7+
};
8+
const handleNewWrite = () => {
9+
router.push('/write');
1110
};
12-
1311
return (
1412
<div className="flex w-full gap-6">
1513
<button
1614
type="button"
15+
onClick={handleNewWrite}
1716
className="bg-primary flex-1 rounded-xl py-4 text-center text-base font-semibold text-white shadow-sm transition hover:bg-violet-500 active:bg-violet-700 disabled:cursor-not-allowed disabled:opacity-60"
1817
>
1918
새 TIL 작성
2019
</button>
2120

2221
<button
2322
type="button"
24-
onClick={handleAddClick}
23+
onClick={handleNewPlan}
2524
className="flex-1 rounded-xl border border-slate-300 bg-none py-4 text-center text-base font-semibold text-slate-700 transition hover:bg-slate-200 active:bg-slate-300 disabled:cursor-not-allowed disabled:opacity-60"
2625
>
2726
플랜 추가하기

0 commit comments

Comments
 (0)