Skip to content

Commit 5bbb9a6

Browse files
authored
Merge pull request #124 from part3-4team-Taskify/feature/Gnb
[Feat] landing: 로그인 상태일 때 '대시보드 이동하기' 버튼으로 전환
2 parents b4de13b + 0fbc437 commit 5bbb9a6

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

src/components/landing/Section1.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1+
import { useRouter } from "next/router";
2+
import useUserStore from "@/store/useUserStore";
13
import Image from "next/image";
2-
import Link from "next/link";
34

45
export default function Section1() {
6+
const user = useUserStore((state) => state.user);
7+
const isLoggedIn = !!user;
8+
const router = useRouter();
9+
10+
const handleMainClick = () => {
11+
if (isLoggedIn) {
12+
router.push("/mydashboard");
13+
} else {
14+
router.push("/login");
15+
}
16+
};
17+
518
return (
619
<section className="w-full bg-[var(--color-black)] text-[var(--color-white)] px-4 pt-[94px] sm:pt-[42px] flex flex-col items-center">
720
{/* 히어로 이미지 */}
@@ -34,12 +47,12 @@ export default function Section1() {
3447
</span>
3548

3649
{/* CTA 버튼 */}
37-
<Link
38-
href="/login"
39-
className="mt-[66px] w-[280px] h-[54px] flex items-center justify-center rounded-lg bg-[var(--primary)] text-[var(--color-white)] font-16m sm:mt-[70px]"
50+
<button
51+
onClick={handleMainClick}
52+
className="mt-[66px] w-[280px] h-[54px] flex items-center justify-center rounded-lg bg-[var(--primary)] text-[var(--color-white)] font-16m sm:mt-[70px] cursor-pointer"
4053
>
41-
로그인하기
42-
</Link>
54+
{isLoggedIn ? "대시보드 이동하기" : "로그인하기"}
55+
</button>
4356
</section>
4457
);
4558
}

src/pages/mydashboard.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import InvitedDashBoard from "@/components/table/invited/InvitedDashBoard";
1212
import NewDashboard from "@/components/modal/NewDashboard";
1313
import { Modal } from "@/components/modal/Modal";
1414
import { CustomBtn } from "@/components/button/CustomButton";
15-
1615
import LoadingSpinner from "@/components/common/LoadingSpinner";
1716

1817
interface Dashboard {

0 commit comments

Comments
 (0)