Skip to content

Commit d1520f4

Browse files
committed
[fix] 헤더, 드롭다운 메뉴 알림 버튼 수정(router 연결)
1 parent da16f49 commit d1520f4

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

src/shared/components/header/DropdownMenu.tsx

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { navItem } from '@/shared/utills/navigation';
44
import Image from 'next/image';
55
import Close from '@/shared/assets/icons/close_32.svg';
66
import User from '@/shared/assets/icons/user_24.svg';
7+
import Bell from '@/shared/assets/icons/bell_24.svg';
78
import Link from 'next/link';
89
import { usePathname } from 'next/navigation';
910
import { useEffect, useRef, useState } from 'react';
@@ -13,6 +14,7 @@ import { createPortal } from 'react-dom';
1314
import { useAuthStore } from '@/domains/shared/store/auth';
1415
import { setPreLoginPath } from '@/domains/shared/auth/utils/setPreLoginPath';
1516
import LogoutConfirm from '@/domains/login/components/LogoutConfirm';
17+
import { useRouter } from 'next/navigation';
1618

1719
interface Props {
1820
isClicked: boolean;
@@ -28,8 +30,9 @@ function DropdownMenu({ isClicked, setIsClicked, visible, setVisible }: Props) {
2830
const tlRef = useRef<GSAPTimeline | null>(null);
2931
const [mounted, setMounted] = useState(false);
3032

31-
const { isLoggedIn, logout } = useAuthStore();
33+
const { isLoggedIn } = useAuthStore();
3234
const [logoutModalOpen, setLogoutModalOpen] = useState(false);
35+
const router = useRouter();
3336

3437
useEffect(() => {
3538
setMounted(true);
@@ -87,7 +90,7 @@ function DropdownMenu({ isClicked, setIsClicked, visible, setVisible }: Props) {
8790
className="w-[62px] md:w-[82px] h-auto"
8891
/>
8992
</div>
90-
<ul className="flex flex-col gap-[12px] text-black px-2 my-5">
93+
<ul className="flex flex-col gap-[12px] text-black my-5">
9194
{navItem
9295
.filter((item) => {
9396
// 비로그인 유저 마이페이지 숨기기
@@ -121,17 +124,32 @@ function DropdownMenu({ isClicked, setIsClicked, visible, setVisible }: Props) {
121124

122125
<div className="border border-t-[1px] border-t-gray flex items-center py-[32px] gap-2">
123126
{isLoggedIn ? (
124-
<button
125-
type="button"
126-
onClick={() => {
127-
setLogoutModalOpen(true);
128-
setIsClicked(false);
129-
}}
130-
className="flex items-center gap-2 text-black font-light text-xl hover:text-black/70"
131-
>
132-
<User color="var(--color-primary)" aria-hidden />
133-
<span>로그아웃</span>
134-
</button>
127+
<div className="flex flex-col gap-3">
128+
<button
129+
type="button"
130+
onClick={() => {
131+
setLogoutModalOpen(true);
132+
setIsClicked(false);
133+
}}
134+
className="flex items-center gap-2 text-black font-light text-xl hover:text-black/70"
135+
>
136+
<User color="var(--color-primary)" aria-hidden />
137+
<span>로그아웃</span>
138+
</button>
139+
140+
<button
141+
type="button"
142+
onClick={() => {
143+
setIsClicked(false);
144+
145+
router.push('/mypage/my-alarm');
146+
}}
147+
className="flex items-center gap-2 text-black font-light text-xl hover:text-black/70"
148+
>
149+
<Bell color="var(--color-primary)" aria-hidden />
150+
<span>알림</span>
151+
</button>
152+
</div>
135153
) : (
136154
<Link
137155
href="/login"

src/shared/components/header/HeaderBtn.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ function HeaderBtn({ pathname }: { pathname: string }) {
1818
{
1919
icon: Bell,
2020
label: '알림',
21-
onClick: () => setLogoutModalOpen(true),
21+
className: pathname === '/mypage/my-alarm' ? 'text-tertiary' : 'text-current',
22+
hiddenMobile: true,
23+
onClick: () => router.push('/mypage/my-alarm'),
2224
},
2325
{
2426
icon: User,

0 commit comments

Comments
 (0)