Skip to content

Commit 8a9c599

Browse files
authored
Merge pull request #41 from DeveloperBlog-Devflow/feature/home-page
feat: 홈페이지 버튼 라우팅
2 parents 9e58675 + 0338edc commit 8a9c599

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

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)